473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to make scripts for 2 submit buttons?

Hi all,

I have a checkout page in my online shopping cart that needs two submit
buttons that direct to two seperate pages. Whichever button the user clicks,
the destination page will use much the same values via Request.Form but will
just do different things with them.

One of the buttons will be a submit button. Can I have two submit buttons or
even another button in the same form that redirects to a different page than
the submit button redirects to but also allows the target page to use
Request.Form to return the previous pages form values?

Is there a javascript to do this?

Sorry its so long winded.

Regards

Penny.
Jul 23 '05 #1
4 1612
Penny wrote:
Hi all,

I have a checkout page in my online shopping cart that needs two submit
buttons that direct to two seperate pages. Whichever button the user clicks,
the destination page will use much the same values via Request.Form but will
just do different things with them.

One of the buttons will be a submit button. Can I have two submit buttons or
even another button in the same form that redirects to a different page than
the submit button redirects to but also allows the target page to use
Request.Form to return the previous pages form values?
It is better to let the server determine what to do with the page, in
case JS is disabled.
Is there a javascript to do this?


<input type="submit" onclick="this.form.action='somePage.php'"
value="somePage">

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
Hi Randy,
It is better to let the server determine what to do with the page, in
case JS is disabled.
By this do you mean use ASP/PHP or the like to determine which page to
redirect to?
<input type="submit" onclick="this.form.action='somePage.php'"

value="somePage">

Do you mean that you can have 2 submit buttons of the type "submit" and use
each one's onclick to redirect accordingly?

Regards

Penny

Jul 23 '05 #3
Penny wrote:
It is better to let the server determine what to do with the page, in
case JS is disabled.
By this do you mean use ASP/PHP or the like to determine which page to
redirect to?


Or whatever language you are using on the server.

if ($_REQUEST['submit'] == "itemOne") {
itemOne();
} elsif ($_REQUEST['submit'] == "itemTwo") {
itemTwo();
} else {
defaultBehaviour();
}

Just make sure you name your submit inputs. The activated one will be the
only one which is successful.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #4
Thanks David,

Now I get it!

Regards

Penny
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Antoni | last post by:
Hello, I wondered if anyone could offer some guidance over my php script. I was hoping the example would allow the user to click the submit buttons and the item number increment. And when the...
4
by: Bob Lehmann | last post by:
Hi, I pretty sure I've seen this problem addressed before, but I can't find any references. The short story is that I have I have multiple submit buttons on a page, each providing different...
2
by: JR | last post by:
Hi. I have a CGI script that will need to call itself an unknown number of times, to add rows, run queries, etc. At the bottom of the output that is produced by the script, there are four...
9
by: Ale K. | last post by:
What's the best way to make a form return a value.... i want to try to avoid using module variables for doing this... Thanks. Alex.
9
by: Poker Man | last post by:
Hi, I know how to do Sumbit buttons in Forms, and I know how to do custom buttons in Javascript. What I can't seem to find is how to do custom Submit buttons using Javascript! Anybody out...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
1
by: Bill_W_Stephens | last post by:
I have a complicated page with several submit buttons. I don't want to create multiple forms because much of the input is shared and the code is getting very ugly. However I would like to determine...
2
by: rudranee | last post by:
hello, How do i declare multiple submit buttons on a form? and how do i come to know on the next page which button has been clicked? Can i do it in JSP page? Please tell me.
5
by: Alex | last post by:
Hello, I hope I can explain this properly. I'm writing an application with a tabbed-based navigation, and a form which gets filled out by users will be split into 5 subtabs. What I need is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.