How would i combined 2 html forms
I am trying to combined to forms that are in different position. so i can post all the data at once.
Here is a eg
<form action="actions.php">
<input type="text">
<input type="text">
<input type="submit" name="button" id="button" value="submit" />
</form>
<form>
<input type="text">
<input type="text">
</form>
You can add hidden fields in the second form and fill these fields (using java script) with the first form values before submission.
I know how old this question is, but here is the answer anyway, using HTML5 Form attribute. (an attribute not a tag.)
Just make an id for your main form (i.e. id="main-form")
And in your other inputs (without using another form tag) put the new HTML5 form attribute (an attribute not a tag) with a value of your main form id (i.e. form="main-form").
* However It's not supported in IE
<form action="actions.php" id="main-form">
<input type="text">
<input type="text">
<input type="submit" name="button" id="button" value="submit" />
</form>
<input type="text" form="main-form">
<input type="text" form="main-form">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With