title: PHP - making a switch statement using id from form input
body: <p>I'm making a short quiz in PHP that tells you what creature your thinking of based on 4 yes/no questions. I have made it so that depending on your answer to each question you get taken to a different question, I did this using mainly switch statements.</p>
  
  <p>My question is is there any way that I can make a switch statement with the condition as the id from the submit buttons from the form?</p>
  
  <pre><code>      echo "&lt;form method ='post' action='Creatures.php'&gt;
       &lt;input type='submit' name='answer' id='1' value='Yes' /&gt;
       &lt;input type='submit' name='answer' id='2' value='No' /&gt;
       &lt;/form&gt;";
  </code></pre>
  
  <p>This is the form I'm using to display the buttons, I have made it so that each button has a different id so at the end of the quiz, depending on what the id of the last button pressed is, I can display the right answer. Below is what I tried to do but it didn't work.</p>
  
  <pre><code>switch($_POST['id'])
  {
   case 1: echo "It's a goldfish";
   case 2: echo "It's a eel";
  }
  </code></pre>
  
  <p>Also these fields are the only ones which use id's throughout the whole web page, any suggestions on how I can get this to work properly, not necessarily using switch statements?</p>