Hi! I want to create a drop-down menu and let the user select an option. After selecting the option, it will provide a link to another page. But I have problems creating the right link. Take a look at these codes in menu.html:
[CODE]
<form id=”form1″ name=”form1″ method=”post” action=”menu.php”>
Menu
<select name=”Menu” size=”1″ id=”Menu”>
<option value=”option1″>Option 1</option>
<option value=”option2″>Option 2</option>
</select>
<label for=”label”>menu</label>
<input type=”submit” name=”Menu2″ id=”label” value=”Submit” />
</form>
Then, I have another file called menu.php with these codes:
[CODE]
<?php
$selection = $_POST[‘Menu’];
if ( $selection == “option1″) {
<a href=”http://www.<mysite.com/option1.html>”>Option 1</a>
} else if ( $selection == “option2″) {
<a href=”http://www.<mysite.com/option2.html”>Option 2</a>
}
?>
I’m not sure if there is a better way of doing it but the result is not what I expected. I should see Option 1 if the user selects only option1 but now I’m seeing the PHP codes from Option 1 onwards.
Please advise. Many thanks!