title: Get selected option from the tag <select> in php to use on if
body: <p>I tried this code:</p>
  
  <pre><code>&lt;select name="selectedOption"&gt;
      &lt;option value="select"&gt;  Select  &lt;/option&gt;
      &lt;option value="option1"&gt;  option 1  &lt;/option&gt;
      &lt;option value="option2"&gt;  option 2  &lt;/option&gt;
  &lt;/select&gt;
  &lt;?php $selectedOption = $_POST['selectedOption']; ?&gt;
  &lt;?php if($selectedOption == "option1") : ?&gt;
      &lt;a href="#"&gt;This will only display if option 1 selected&lt;/a&gt;
  &lt;?php elseif($selectedOption == "option2") : ?&gt;
      &lt;a href="#"&gt;This will only display if option 2 selected&lt;/a&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>But I get errors when I'm testing it on the web.
  The error that apears is "Notice: Undefined index: selectedOption in C:\wamp\www\vilaLuz\index.php on line 40"</p>
  
  <p>What I am trying to do is get the option from the select and put a text under if option 1 is selected and a different text under if option 2 is selected, is that possible?</p>