ag3nt42 Posted June 2, 2008 Share Posted June 2, 2008 I have a form for an install file i'm setting up.. I would like to be able to create two submit buttons for the one form and have one submit button go to one page and the other to another. Anyone have ne ideas on this plz share. thankx, ag3nt Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 2, 2008 Share Posted June 2, 2008 it requires that javascript is enabled...but it works: <form action="test1.php"> <input type="submit" /> <input type="submit" onclick="this.form.action='test2.php';" /> </form> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted June 2, 2008 Share Posted June 2, 2008 Why bother? Give the submit buttons different names and handle them on the same page. Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 2, 2008 Author Share Posted June 2, 2008 i can't handle them on the same page.. I need them to go to seperate pages.. thanks rhodesa i'll give that a shot Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 2, 2008 Share Posted June 2, 2008 If they have to be separate pages, then do it that way. But GingerRobot's option is the better way to handle it. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted June 2, 2008 Share Posted June 2, 2008 i can't handle them on the same page.. I need them to go to seperate pages.. thanks rhodesa i'll give that a shot Unless your posting to another website, then why not? You can handle the form's on one page and redirect someone to the appropriate page after. Quote Link to comment Share on other sites More sharing options...
mushroom Posted June 2, 2008 Share Posted June 2, 2008 if ($submit_button=="other_option") { include("other_php_page"); # code for that button } elseif ($submit_button=="normal_option") { # code for that button } else { # code for no button } Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 2, 2008 Author Share Posted June 2, 2008 its ok the first options worked the best for me guys.. basically one button runs a database connection test and the other runs the install file. But I needed the test button to display the information directly on that page rather then sending them to another one. I spose you could do that on the same page and the redirect them after wards but this seems so much simpler on everyone. thankx for all the options though guys.. i really appreciate your responses. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.