I want to submit 2 forms from the same page with one button, so I tried to use the Javascript technic described in this post.
Here is my code:
send.php:
<form action="receive.php" method="post" id="form1">
<input type="text" value="2nd Form" name="q1" />
</form>
<form action="receive.php" method="post" id="form2">
<input type="text" value="3rd Form" name="q2" />
</form>
<input type="button" value="Click Me!" onclick="submitForms()" />
<script>
submitForms = function(){
document.getElementById("form1").submit();
document.getElementById("form2").submit();
}
</script>
receive.php:
echo $_POST['q1'];
echo $_POST['q2'];
But when it redirects to receive.php only the value of $_POST['q2']
appears, and not the value from the 1st input.
I can't see why is it so. Thank you.