You want some javascript that'll use the onChange or similar trigger to change the document.location value which will force it to jump to another page!
In short, that's javascript, not PHP ;)
Jumping to another PHP page.
Moderators: egami, macek, gesf
if your php code is in the middle of executing, i.e. it has not gotten to the user yet, there is a way. You can call the header function.
read more at:
http://www.php.net/manual/en/function.header.php
you could have the user select from a form the page he or she wants to go to, the on the page that handles the form submit, you could do some logic, then have the page return the user to a specified place.
it does seem in your post however that you want to the page to respond to a users choice for a new page directly, without the need for any other logic, at which point you should use javascript:
read more at:
http://www.php.net/manual/en/function.header.php
you could have the user select from a form the page he or she wants to go to, the on the page that handles the form submit, you could do some logic, then have the page return the user to a specified place.
it does seem in your post however that you want to the page to respond to a users choice for a new page directly, without the need for any other logic, at which point you should use javascript:
Code: Select all
<form action="choosepage.php">
<select name="goto">
<option value="http://yoursite/page1.html">
</select>
...
...
</form>
Code: Select all
<?php
$goto = $_POST['goto']
$others = $_POST[...];
... perform action on $other variables
header( "Location: $goto" );
?>