Jump to content

Directional forms


user4fun
 Share

Recommended Posts

I have a formwith one text filed calledsitei want to have three buttons instead of the traditional oneeach button will take A DIFFERENT DIRECTIONButton1called check_emwill run action = "check.php method="post"Button 2calledList_emwill run action= "list.php" method = "POST"button 3calledcontact_emwill run action = "contact.php method = "POST"How would i do that?

Link to comment
Share on other sites

A form can only have a single action and a single method. You can mess around with Javascript to change the action, but it's a lot easier to just have the whole thing submit to one page, figure out which button they hit, and do whatever is appropriate. Instead of having 3 pages that each do 1 thing, have 1 page that does 3 things. You can check which button was clicked by giving the same name to all of your buttons and checking the value.<input type="submit" name="page_mode" value="Check"><input type="submit" name="page_mode" value="List"><input type="submit" name="page_mode" value="Contact">

<?php$page_mode = $_POST['page_mode'];if ($page_mode == "Check") // they clicked Checkif ($page_mode == "List") // they clicked Listif ($page_mode == "Contact") // they clicked Contact?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...