Two submit buttons

This is a discussion on "Two submit buttons" within the Web Page Design section. This forum, and the thread "Two submit buttons are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 28th, 2005, 16:15
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
Two submit buttons

how can i have two submit buttons for one form that go to different pages? for example, a 'submit' and 'preview' button for a post entry? submit would go to addpost.php and preview go to preview.php... ?
Reply With Quote

  #2 (permalink)  
Old Jun 29th, 2005, 09:10
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
you could try using onclick on each of the submit buttons, when they are clicked change the action of your form using javascript to addpost.php or preivew.php.

Make sense?
Reply With Quote
  #3 (permalink)  
Old Jun 29th, 2005, 11:20
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
yea thanks smokie
Reply With Quote
  #4 (permalink)  
Old Jun 29th, 2005, 13:13
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
There's no need - you can actually detect which was pressed in PHP!

If you name your submit button 'submit' then that variable can be accessed by:
Code: Select all
if (!isset($HTTP_POST_VARS['Submit']))
and the same goes for naming a submit button anything else...

This solution is server side (clearly) and is therefore more reliable than a Javascript solution.
Reply With Quote
  #5 (permalink)  
Old Jun 29th, 2005, 15:00
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
ok thanks sirkent the site is written in php, so that example was perfect!
Reply With Quote
  #6 (permalink)  
Old Jun 29th, 2005, 16:04
Reputable Member
Join Date: Sep 2004
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
You can do it with ASP as well, just by requesting it from the form.
Reply With Quote
  #7 (permalink)  
Old Jun 29th, 2005, 20:54
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry, my example wasn't very good - I'm assuming you know how to use !isset
Reply With Quote
  #8 (permalink)  
Old Jun 29th, 2005, 20:59
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
yea i do thanks
Reply With Quote
Reply

Tags
two, submit, buttons

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
submit many forms - auto submit the same form many times divs JavaScript Forum 0 May 24th, 2007 10:10
How do i submit a form with radio buttons ? Accurax Web Page Design 5 May 12th, 2007 18:34
Submit Buttons cewgirl Starting Out 14 Apr 3rd, 2007 01:28
Validation problem with multiple submit buttons celia05es JavaScript Forum 2 Sep 29th, 2005 08:19
Styling submit buttons using CSS wheatus Web Page Design 3 Jul 24th, 2004 07:32


All times are GMT. The time now is 02:36.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43