In index.php I have a form:
<form name="UserLocation" action="propForSale.php" method="GET">
Once the user types in the name of a location in the text box on the form, they click on the “For Sale” submit button:
<input type="submit" value="For Sale" />
This takes the user to propForSale.php page as specified in the action attribute.
But I now have another button on the form in index.php:
<input type="submit" value="To Rent" />
I now want the user to be directed to “propToRent.php” when they click on the “To Rent” button.
At the moment, it take the user to “propForSale.php” when they click on the “To Rent” button. This is probably because it is specified in the action attribute of the form to go to that particular page. But how do I get it to go to “propToRent.php”?
Thanks in advance
You can have two buttons and use Javascript to change the action of form and submit it to different pages, but I think the drop-down menu is the simpler solution. Anyway, to use two buttons you’ll need something like: