title: Echo 'selected' in html5 dropdown form using PHP
body: <p>I have a form that fetches user info into the $row variable so forms are populated if the row exists if the database, but then saves any new input through the $_POST global variable, in case the user makes a mistake elsewhere on the form. It all works great.</p>
  
  <pre><code>    &lt;label for="qualification2"&gt;Grade:&lt;/label&gt;
          &lt;input type="text" name="qualification2" id="grade2" class="form-control" 
          value="&lt;?php if(isset($_POST['qualification2'])) { 
          echo $_POST['qualification2']; 
          } else { echo ($row ['qualification2']); } ?&gt;"&gt;
  </code></pre>
  
  <p>I would like to do similar using a selection dropdown box but the code doesn't seem to work the same with dropdown boxes and I wonder what I'm doing wrong or if this is even possible.</p>
  
  <p>I've also tried echo from the $row variable but that doesn't work either</p>
  
  <pre><code>    &lt;?php if($row['qualMonth2'] == 'February') { echo ' selected'; } ?&gt;
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>    &lt;select input type="text" name="qualMonth2" id="qualMonth2" value="Select Month"&gt;
           &lt;option value="January" &lt;?php if(isset($_POST['qualMonth2']) == 'January') { echo ' selected'; } ?&gt;&gt;January&lt;/option&gt;
            &lt;option value="February" &lt;?php if(isset($_POST['qualMonth2']) == 'February') { echo ' selected'; } ?&gt;&gt;February&lt;/option&gt;
            &lt;option value="March" &lt;?php if(isset($_POST['qualMonth2']) == 'March') { echo ' selected'; } ?&gt;&gt;March&lt;/option&gt;
            &lt;option value="April" &lt;?php if(isset($_POST['qualMonth2']) == 'April') { echo ' selected'; } ?&gt;&gt;April&lt;/option&gt;
            &lt;option value="May" &lt;?php if(isset($_POST['qualMonth2']) == 'May') { echo ' selected'; } ?&gt;&gt;May&lt;/option&gt;
            &lt;option value="June" &lt;?php if(isset($_POST['qualMonth2']) == 'June') { echo ' selected'; } ?&gt;&gt;June&lt;/option&gt;
            &lt;option value="July" &lt;?php if(isset($_POST['qualMonth2']) == 'July') { echo ' selected'; } ?&gt;&gt;July&lt;/option&gt;
            &lt;option value="August" &lt;?php if(isset($_POST['qualMonth2']) == 'August') { echo ' selected'; } ?&gt;&gt;August&lt;/option&gt;
            &lt;option value="September" &lt;?php if(isset($_POST['qualMonth2']) == 'September') { echo ' selected'; } ?&gt;&gt;September&lt;/option&gt;
            &lt;option value="October" &lt;?php if(isset($_POST['qualMonth2']) == 'October') { echo ' selected'; } ?&gt;&gt;October&lt;/option&gt;
            &lt;option value="November" &lt;?php if(isset($_POST['qualMonth2']) == 'November') { echo ' selected'; } ?&gt;&gt;November&lt;/option&gt;
            &lt;option value="December" &lt;?php if(isset($_POST['qualMonth2']) == 'December') { echo ' selected'; } ?&gt;&gt;December&lt;/option&gt;
        &lt;/select&gt;
  </code></pre>