SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Nested Form - Parent submit button not working

    hi all

    i have <form> inside <form>

    the parent form submit button doesnt works. But nested form submit buton works.

    I want both submit buttons to work as both does different tasks.

    what am i doing wrong ?

    PHP Code:
    <?
    if(isset($_REQUEST['submit']))
    {
        echo 
    "submit Parent"/*This message doesnt echo */
    }
    if(isset(
    $_REQUEST['av_submit']))
    {
        echo 
    "submit Nested"/* This message is echo fine */
    }
    ?>

    <?
    echo  "<form id='form1' name='form1' method='post' action='$qrystring'>";

    // for 2nd starts which is inside a loop
    echo "<form name='avform' id='avform' method='post' action='$qrystring2'>";
    echo  
    "<input name='amt[]' type='checkbox' value='child' id='child' />child <br>";  
    echo 
    "<input type='submit' value='submit Nested' name='av_submit'/>"
    echo 
    "</form>";

    // form 2nd ends

    echo "<td><input name='submit' type='submit' value='submit Parent'/></td>";
    echo 
    "</form>";
    ?>
    vineet

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Ummm nested forms don't work at all. You need to rethink how you are setting this form up.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hi

    i tried putting the form inside <iframe>

    but now how will i use the variables values that were being used in parent page.

    I m not getting values of those variables to work inside <iframe>

    vineet

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Don't use an iframe (I'm not sure why you are), restructure your form as per logic_earth's suggestion.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If i use ajax popup and insert this form inside that pop up

    then will i be able to use those variables from parent page inside my pop ?

    or ajax pop will also work same as iframe ?


    vineet

  6. #6
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Just "pop up" the form, which already exists in the DOM. Again, I'm not why you need an iframe here.

    Lets get this thread moved the JS forum for now, you can get your form/pop-up/iframe stuff working there then come back and we'll help with the nard stuff.

    Anthony.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  7. #7
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i want to use PHP variables values that are in parent page

    how will javascript people help me about PHP variables

    correct me if i m wrong

    vineet

  8. #8
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If we forget about the <from> part

    I know how to create popup or iframe

    but can anyone tell me in general how to use PHP variables values from parent page inside the <iframe> or "Popup" box

    vineet

  9. #9
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Popup box is just on teh same page, so you just use the variables as normal - output them in the right place!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •