title: Echo value of select box
body: <p>So I have a basic select dropdown box:</p>
  
  <pre><code>      &lt;select class="form-control" name="work_place"&gt;
          &lt;option&gt;Work Place 1&lt;/option&gt;
          &lt;option&gt;Work Place 2&lt;/option&gt;
          &lt;option&gt;Work Place 3&lt;/option&gt;
          &lt;option&gt;Work Place 4&lt;/option&gt;
        &lt;/select&gt;
  </code></pre>
  
  <p>With php code:</p>
  
  <pre><code>$work  = $_POST['work_place'];
  </code></pre>
  
  <p>If I want to edit it later, what is the best way to echo selected value?</p>
  
  <p><strong>SOLVED</strong>
  Thanks for the "help", here is the answer:</p>
  
  <pre><code>      &lt;select class="form-control" name="work_place"&gt;
          &lt;option &lt;?php echo ($edit_row["workPlace"] === "Work Place 1")?"selected" : ""; ?&gt; &gt;Work Place 1&lt;/option&gt;
          &lt;option &lt;?php echo ($edit_row["workPlace"] === "Work Place 2")?"selected" : ""; ?&gt; &gt;Work Place 2&lt;/option&gt;
          &lt;option &lt;?php echo ($edit_row["workPlace"] === "Work Place 3")?"selected" : ""; ?&gt; &gt;Work Place 3&lt;/option&gt;
          &lt;option &lt;?php echo ($edit_row["workPlace"] === "Work Place 4")?"selected" : ""; ?&gt; &gt;Work Place 4&lt;/option&gt;
        &lt;/select&gt;
  </code></pre>
  
  <p>It echoes the selected dropdown option.</p>