PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<html>
<body>
<?php
if ($_POST['select'] == "Option 3"){
[color=#BF0000]what to write here so i can navigate to other page[/color]
}
?>
</body>
</html>
but that If is very important. In your example, it must be done before even the lines <html> and <body> and there cannot even be a blank line before the <?php line. If you send anything before the header, you will receive an error message and it will not work. Read this: http://us2.php.net/manual/en/function.header.php.
If you cannot arrange to do this, then you can send Javascript, and if the browser has not disabled Javascript, it will send the browser to a new URL, like:
This is not a solution but want to point out that I think you might need to check for when the button is clicked and assign the option selected to a variable. It would be great to see this problem solved as i would also like to know.
For Example:
Ordinarily there is no need to check for the submit button. And I just presented 2 solutions.
It would be appropriate to use PHP's switch syntax rather than If syntax, and if it were me, I'd use simple numbers as the option values, but his syntax would work as shown. Another variation would be to use the entire URL as the option value, eliminating the branching entirely:
<select name="myselect"> // avoid using key words as names!
<option value="http://www.NBK.com/" selected>NBK</option>
<option value="http://www.GBK.com/">GBK</option>
... etc.
califdon wrote:Ordinarily there is no need to check for the submit button. And I just presented 2 solutions.
It would be appropriate to use PHP's switch syntax rather than If syntax, and if it were me, I'd use simple numbers as the option values, but his syntax would work as shown. Another variation would be to use the entire URL as the option value, eliminating the branching entirely:
<select name="myselect"> // avoid using key words as names!
<option value="http://www.NBK.com/" selected>NBK</option>
<option value="http://www.GBK.com/">GBK</option>
... etc.