Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing forms values between pages

Status
Not open for further replies.

ciupaz

Programmer
Jun 15, 2009
6
Hi all,
I have an HTML page (or .aspx page) with one form, containing several input elements, and 2 button (input type="submit"), like this example:


<form id="myForm" method="post" action="">

Client Name: <br />
<input type="text" id="clientName" name="clientName" />

Client Surname: <br />
<input type="text" id="clientSurname" name="clientSurname" />

<br />
<input type="submit" id="submit1" value="Go to page 1" />
<input type="submit" id="submit2" value="Go to page 2" />

</form>



My problem is to pass all input elements values (entered by users) to 2 different pages, accordingly pressed button.
For example if the user press button1, the "action" of my form is setted to Page1.htm, and if pressed button2, the action is setted to Page2.htm.
Of course in these two pages I must recover the input values (for example to populate some labels).

Anyone can help me to solve this problem?

Thanks in advance.

Luis
 
I don't understand the question. The form data is passed to the chosen action.

Cheers,
Dian
 
In my form the action is empty, and my goal is to set this "action" accordingly to the pressed button.
For example is the user press button1 -> action="Test1.htm"
if the user press button2 -> action="Test2.htm"
 
Hi

Code:
[b]<form[/b] [maroon]id[/maroon][teal]=[/teal][green][i]"myForm"[/i][/green] [maroon]method[/maroon][teal]=[/teal][green][i]"post"[/i][/green] [maroon]action[/maroon][teal]=[/teal][green][i]""[/i][/green][b]>[/b]
    
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]"submit"[/i][/green] [maroon]id[/maroon][teal]=[/teal][green][i]"submit1"[/i][/green] [maroon]value[/maroon][teal]=[/teal][green][i]"Go to page 1"[/i][/green] [maroon]onclick[/maroon][teal]=[/teal][green][i]"this.form.action='Test1.htm'"[/i][/green][b]/>[/b]
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]"submit"[/i][/green] [maroon]id[/maroon][teal]=[/teal][green][i]"submit2"[/i][/green] [maroon]value[/maroon][teal]=[/teal][green][i]"Go to page 2"[/i][/green] [maroon]onclick[/maroon][teal]=[/teal][green][i]"this.form.action='Test2.htm'"[/i][/green][b]/>[/b]

[b]</form>[/b]

Feherke.
 
Ok, this is work feherke.
But now, in the second page how can I recover the values inserted in the first form?

Luis
 
Ok, thank you very much feherke.

Luis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top