Advertisement
lalatino

send two forms at once

Aug 10th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.65 KB | None | 0 0
  1. <?php
  2.    var_export($_POST);
  3. ?>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <title> http://stackoverflow.com/questions/11900510/submit-two-form-contents-onto-one-action-page </title>
  8.  
  9. <script type="text/javascript">
  10.  
  11. // wrong function
  12. function somefunction() {
  13.   document.forms["form1"].submit();
  14.   //alert('test');
  15.   document.forms["form2"].submit();
  16. }
  17.  
  18. </script>
  19. </head>
  20. <body>
  21.  
  22. <form name="form1" action="" method="post">
  23. <input name="t1" type="text" value="t1">
  24. </form>
  25.  
  26. <form name="form2" action="" method="post">
  27. <input name="t2" type="text" value="t2">
  28. </form>
  29.  
  30. <input type="button" onclick="somefunction()" value="send" />
  31.  
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement