Annyta Posted February 18, 2017 Share Posted February 18, 2017 Please help me. I know this question is a beginner's question, now I am learning Switch Operator and I can't understand why my code doesn't work in browser. I asked on other forums this question but people there say that there are errors in every line and that I am a fool that I don't see it. But I don't see it. I tried to write it correctly, but I don't know why it doesn't work. Please tell to a fool one where is the mistake? HTML <!doctype html><html><meta charset = "utf-8"><head><body> <form action = "index.php" method="get"> <tr> <td>What do you you select?</td> <select name = "find"> <option value = "a"> A <option value = "b"> B <option value="c" > C </select></td></tr> <input type="submit" name="submit" value="Send My Posting" /> </form></body></html> PHP <?php $find = $_POST["find"]; switch($find){ case "a"; echo "you selected A"; break; case "b"; echo "you selected B"; break; case "c"; echo "you selected C"; break; ?> Quote Link to comment https://forums.phpfreaks.com/topic/303225-where-is-the-mistake/ Share on other sites More sharing options...
Solution requinix Posted February 18, 2017 Solution Share Posted February 18, 2017 Your form has method="get" but you are using $_POST. method=get goes with $_GET, method=post goes with $_POST. Quote Link to comment https://forums.phpfreaks.com/topic/303225-where-is-the-mistake/#findComment-1542975 Share on other sites More sharing options...
Annyta Posted February 18, 2017 Author Share Posted February 18, 2017 Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/303225-where-is-the-mistake/#findComment-1542977 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.