Form with 2 submit buttons

From: Date: Wed, 06 Sep 2000 01:29:11 +0000
Subject: Form with 2 submit buttons
Groups: php.general 
Request: Send a blank email to php-general+get-15413@lists.php.net to get a copy of this message
HI, I want to know what is the best way to go about this situation. I have a set of pages that make up a wizard type implementaion, so I have a "Previous" and a "Next" button on each page. Both of these buttons are on the Same <FORM>. Each button has a different action -eg. Previous button goes to page1.php and Next button goes to page3.php. When I submit, it submits to itself. Here is code example: if (btnNext is pressed) { $bok = checkmandatories(); if ($bok) goto "next" page - page3.php; } else if (btnPrev is pressed) { goto "previous" page - page1.php; } <BODY> <FORM name=details METHOD=POST> <INPUT type=text name....> <INPUT type=text name....> <INPUT type=submit name=btnPrev value="Previous"> <INPUT type=submit name=btnNext value="Next"> </FORM> </BODY> How do I determine which button I have pressed? There don't seem to be values for $btnPrev and $btnNext. Also, second problem, how then do I pass all the form name/value pairs to the "action". Is there a way "without" having to build up the name/value pair string to the page if I do a submitting form like this? I'm sure there is a better way to doing this. Thanks! Sam

« previous php.general (#15413) next »