Passing data from a form on one page to another form on another page


How can I pass form data from a form on one page, to a form on another.

Here is what I need exactly:

I am working on the following website:

There is a form in the header titled “Shedule Service”

I would like a user to enter the details, and when he/she clicks the “Go” button, that information should show up in the corresponding fields on the page below:

This means that the user will have to enter information for other fields but not for those already filled afetr data was passed on from the previous form.

Does it make sense?

Your help will be greatly appreciated.


Can you get me some code for doing this?

Thanks a lot

Thank you so much Kalo and FaridHadi.

Could you please help me with sample code of how to achieve this.

I would definitely be grateful.

Thanks again!

What should I include in the form “action” attribute? I am using wordpress

You don’t need any JavaScript for this. Just submit the form using GET or POST to the page where the second form is and then display the data in their respective fields. Let me know if you need more help with this and I’ll write you some example code.

You can transfer form data on one page to a form on another page (assuming it’s all done client side) by either appending a query string containing the first form’s data to the url of the 2nd page or by using cookies.

Hey kyamagero2,

Sorry for the late reply, been busy with work.

So, I’m having a look at your site and I notice that you’re using the Contact Form 7 plugin.
It’s a great plugin, but it’s going to make life a bit difficult for you right now :slight_smile: as it won’t allow you to use PHP in the value attributes. (You could hack the plugin but I wouldn’t recommend that.)

That being said, here’s an option that might work for you.

Step 1: Submit the form, using the GET method, to the page where the second form resides.
Step 2: Use jQuery to extract the data from the URL and push it to the input fields in the form.

Note: You’ll need to add IDs to the First Name, Last Name and Zip input fields in the second form.

If you’re feeling lost you can have a look at this post that I found, it’ll show you how to get the parameters from the URL:

I hope this hasn’t confused you too much :slight_smile:

Let me know if you need more help with this.

I am not sure if it is or isn’t. Since the OP put his/her request in the javascript thread suggests that maybe it isn’t and that is why I put “assuming it’s all done client side” in brackets in my earlier post.

Not necessarily. You can parse the query string in javascript as well to extract the name/value pairs into variables or an array.

I have a few clients, albeit a very small number, who do not have server side scripting enabled on their web hosting accounts because it is not needed for their websites. I suppose it helps them reduce costs. And so JS would be of help in that situation.

Basically, I am not assuming the OP is restricted to either a server or client side solution. I was just suggesting how it can be done client side if that was the only option.

This request for help is in the javascript thread so how would you do it without using javascript, assuming using server side code is not an option?

Hey Kalon,

Why wouldn’t server side code be an option? The site that the OP has linked to seems to be built using WordPress so it should be. Besides, what you mention about “appending a query string containing the first form’s data to the url of the 2nd page” is exactly what would happen if you, as I mentioned, “submit the form using GET” and this method would require server side code.

I don’t see why JS would be required or of any help here. Do you?