Robert Granlund
asked on
Populate form fields fromanother form on submit
Is there a way to populate a forms fields from another form on submit.
I have form one that has :
I have form one that has :
<form id="one" method="POST">
<input type="text" value="" name="first_name">
<input type="text" value="" name="last_name">
</form>
<form id="TWO" method="POST" action="THIS PAGE">
<input type="text" value="" name="first_name">
<input type="text" value="" name="last_name">
<input type="submit" Value="submit">
</form>
So, when I submit form TWO it auto populates form ONE with form two info?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wordpress has a E-commerce plugin, WooCommerce. Woocommerce offers a plugin called Subscriptions.
When you goto a product page and fill out the info for your Subscription and you add to cart it takes you to the Checkout. However, it won't let you go back to the product page and change the info, it clears it. I'm trying to figure out a work around.
When you goto a product page and fill out the info for your Subscription and you add to cart it takes you to the Checkout. However, it won't let you go back to the product page and change the info, it clears it. I'm trying to figure out a work around.
You could post form2 and then have the action script return you to the original page and then use the $_POST variable to autofill form1's fields.
If your intent is to take form2's data and process it via form1's action page, you don't need form1 at all. Just process the data via form2's action and then pass the data to form1's action for further whatevering.
Generally speaking, you don't want to present two different forms on one page and you REALLY don't want to pass data from one to the other on that page because from a UX standpoint it's confusing as all heck. There's almost always a better way to do that using just a single form and controlling what the user sees or does via conditional scripting.