Page 1 of 1

Using Multiple Form Submit Buttons [SOLVED]

Posted: Mon Sep 19, 2005 3:06 pm
by jayshields
Hi guys,

This is the scenario. I have a form, with 4 Submit buttons at the bottom, 3 of them (which all work) just send the user to the same page (as the buttons are on) on click (set in the form tag with action). The other Submit button, I would like it to send the form details (using post) to a different page altogether. Is this possible?

I am presuming there is a simple way of doing this using JavaScript, but I have very, very little experience with JavaScript.

Any help would be much appreciated.

TIA.

Posted: Mon Sep 19, 2005 5:35 pm
by RobertPaul
Well, what you can do is give the last Submit button a different id/name, i.e.

Code: Select all

<input type="submit" id="different" name="different" value="whatever" />
Then on whatever page the form's action is set for, check for $_GET/POST['different'] == "whatever" and redirect accordingly.

It's entirely possible that there's a better way to do this, but this is all I can think of.

Posted: Tue Sep 20, 2005 1:51 am
by n00b Saibot
Last Submit Button should be like following code

Code: Select all

<input type="submit" value="Different Submit" onclick="this.form.action='http://new.loc.com/'">

Posted: Tue Sep 20, 2005 9:50 am
by jayshields
noob saibot :) that looks like it will work idd. thanks for that and i will try it out later.