Multiple form submit using single button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrbadboy
    New Member
    • Jul 2007
    • 21

    Multiple form submit using single button

    Hi,

    I need to submit multiple forms with using single button. I've mentioned my code below.

    <?
    if(isset($_POST )){
    print_r($_POST) ;
    }
    ?>
    <script type="text/javascript">
    function form2Submit() {
    document.f2.act ion="formsubmit 2.php"
    document.f2.sub mit();
    alert('Form2 Submitted');
    }

    function form1Submit() {
    document.f1.act ion="formsubmit 2.php"
    document.f1.sub mit();
    document.getEle mentById("t1"). value = '';
    alert('Form1 Submitted');
    }


    function submitAllForm() {
    form1Submit();
    form2Submit();
    }
    </script>
    </HEAD>

    <body>
    <form name="f1" method="post">
    F1 NAME: <input type="text" name="t1" id="t1" size="24" value="txt1" />
    </form>
    <form name="f2" method="post">
    F2 NAME: <input type="text" name="t2" id="t2" size="24" value="txt2" />
    </form>
    <input type="button" value="Submit" onClick="submit AllForm()" />
    </body>

    Its working properly in IE but not in Mozilla. do you have any idea ?

    Thanks.
  • rpnew
    New Member
    • Aug 2007
    • 189

    #2
    Originally posted by mrbadboy
    Hi,

    I need to submit multiple forms with using single button. I've mentioned my code below.

    <?
    if(isset($_POST )){
    print_r($_POST) ;
    }
    ?>
    <script type="text/javascript">
    function form2Submit() {
    document.f2.act ion="formsubmit 2.php"
    document.f2.sub mit();
    alert('Form2 Submitted');
    }

    function form1Submit() {
    document.f1.act ion="formsubmit 2.php"
    document.f1.sub mit();
    document.getEle mentById("t1"). value = '';
    alert('Form1 Submitted');
    }


    function submitAllForm() {
    form1Submit();
    form2Submit();
    }
    </script>
    </HEAD>

    <body>
    <form name="f1" method="post">
    F1 NAME: <input type="text" name="t1" id="t1" size="24" value="txt1" />
    </form>
    <form name="f2" method="post">
    F2 NAME: <input type="text" name="t2" id="t2" size="24" value="txt2" />
    </form>
    <input type="button" value="Submit" onClick="submit AllForm()" />
    </body>

    Its working properly in IE but not in Mozilla. do you have any idea ?

    Thanks.
    Hi,

    Whats the error you are getting???

    Regards,
    RP

    Comment

    Working...