Using Multiple Form Submit Buttons [SOLVED]

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Using Multiple Form Submit Buttons [SOLVED]

Post 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.
Last edited by jayshields on Tue Sep 20, 2005 9:50 am, edited 1 time in total.
RobertPaul
Forum Contributor
Posts: 122
Joined: Sun Sep 18, 2005 8:54 pm
Location: OCNY

Post 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.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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/'">
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

noob saibot :) that looks like it will work idd. thanks for that and i will try it out later.
Post Reply