How do I pass the user input value of form field to a variable in another page

Hi,

How do I pass the input value of form field to a variable in another page( I mean thank you page).

The form is located on the right rail of this link: https://responsivemts.com/cookingalarm/

Values should be stored in the below variables in the thank you page(Co-reg).

var rm_fname = “”; //First Name
var rm_lname = “”; //Last Name
var rm_email = “”; //Email Address

Please assist

It looks as though your form already processes the inputs, so where, exactly, are you stuck?

Yes, after submission values from the form like firstname, last name and email id should get saved in the below variables set up in the co-reg page.

var rm_fname = “”; //First Name
var rm_lname = “”; //Last Name
var rm_email = “”; //Email Address

If I give First Name as test1 and Last Name as test2, in co-reg page it should be showing like below:
var rm_fname = “test1”; //First Name
var rm_lname = “test2”; //Last Name

Any idea, sorry I am very new to this.

You mean you want to pass them to a JavaScript script?

yes, I dont know how to do that.

Well, you can pass them by echoing the php variables in your JS

var rm_fname = "<?=$firstName?>";
var rm_lname = "<?=$lastName?>";

or whatever your PHP variables are named.

var rm_fname = “<?=$first_name?>”; //First Name
var rm_lname = “<?=$lastName?>”; //Last Name
var rm_email = “<?=$email_address?>”;//Email Address

I have used the above setting but it’s not working. also when I checked in code its not reflecting.

As I said you will have to use whatever you have named your PHP variables. Are you sure those are the correct names?

You’ll need to provide us with your code if it’s still not working with the correct variable names.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.