Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 88
  • Last Modified:

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 :
<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>

Open in new window

So, when I submit form TWO it auto populates form ONE with form two info?
0
rgranlund
Asked:
rgranlund
1 Solution
 
GaryCommented:
When form 2 is submitted then form one becomes defunct (ceases to exist) ...unless you are using javascript to do the form submission thru ajax.
0
 
Jason C. LevineNo oneCommented:
Not totally sure I understand your workflow.

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.
0
 
rgranlundAuthor Commented:
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.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now