I found this code below and it works perfect for what I want BUT I have over 30 options is there something else I can do to shorten the code?
<html>
<body>
<form method="post" action="?">
<select name="dropdown">
<option value="Jehzeel1">Jehzeel1</option>
<option value="Jehzeel2">Jehzeel2</option>
<option value="Jehzeel3">Jehzeel3</option>
</select>
<input type="submit" value="submit">
</form>
</body>
</html>
<?php
switch ($_POST['dropdown']) {
case "Jehzeel1":
echo "Jehzeel likes apples";
break;
case "Jehzeel2":
echo "Jehzeel likes bananas";
break;
case "Jehzeel3":
echo "Jehzeel likes oranges";
break;
?>
It’s easier to create a mapping array:
Although you may want to think twice about your code structure, this looks like a bad practice.
Short way:
EDIT
You can use urls by slightly changing the array and the if statement: