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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I Redirect User Based On Click/Preserve Form Data?

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

This is a basic question but that's still not stopping me from having trouble.

I have a form (FORMA) that has two buttons. The 1st button redirects to (FORMB) after user clicks it.
The second button redirects to (FORMC) after user click.

So the shell of my code looks like:

<body>
<form action=&quot;&quot; name=&quot;forma&quot; method=&quot;post&quot;>

....
<input type=&quot;button&quot; name=&quot;formb_btn&quot; onclick=&quot;window.location.href='formb.cfm'&quot;;>

<input type=&quot;button&quot; name=&quot;formc_btn&quot; onclick=&quot;window.location.href='formc.cfm'&quot;;>

</form>
</body>


I want to pass my FORM A data to the form that's called using the method=&quot;post&quot;, but with my current way of nullifying the action=&quot;&quot;, the form data won't reach my forms.

How do I write the code to say:
- If user clicks on ButtonB, pass all FormA content to FormB
- Else If user clicks on ButtonC, pass all FormA content to FormC?
 
Try this:

[COLOR=000080][COLOR=CC3300]<form action=&quot;&quot; name=&quot;forma&quot; method=&quot;post&quot;>[/color][/color]
[COLOR=000080][COLOR=CC3300]<input type=&quot;submit&quot; name=&quot;formb_btn&quot; onclick=&quot;this.form.action='formb.cfm'&quot;>[/color][/color]
[COLOR=000080][COLOR=CC3300]<input type=&quot;submit&quot; name=&quot;formc_btn&quot; onclick=&quot;this.form.action='formc.cfm'&quot;>[/color][/color]
[COLOR=000080][COLOR=CC3300]</form>[/color][/color] - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top