title: A better solution to handle PHP and HTML <option> logic
body: <p>Wondering if you can show me a better way to handle this logic? I wrote this and am very ashamed of it. Can you show me a better optimized version of this logic?</p>
  
  <p>P.S $result["item"]; returns an integer.</p>
  
  <pre><code>$type = $result["item"];
  switch ($type){
  case "1":
  $type_output = '    
  &lt;option value="1" selected&gt;Cash&lt;/option&gt;
  &lt;option value="2"&gt;Cheque&lt;/option&gt;
  &lt;option value="3"&gt;Debit Card&lt;/option&gt;
  &lt;option value="4"&gt;Credit Card&lt;/option&gt;';
  break;
  
  case "2":
  $type_output = '    
  &lt;option value="1"&gt;Cash&lt;/option&gt;
  &lt;option value="2" selected&gt;Cheque&lt;/option&gt;
  &lt;option value="3"&gt;Debit Card&lt;/option&gt;
  &lt;option value="4"&gt;Credit Card&lt;/option&gt;';
  break;
  
  case "3":
  $type_output = '    
  &lt;option value="1"&gt;Cash&lt;/option&gt;
  &lt;option value="2"&gt;Cheque&lt;/option&gt;
  &lt;option value="3" selected&gt;Debit Card&lt;/option&gt;
  &lt;option value="4"&gt;Credit Card&lt;/option&gt;';
  break;
  
  case "4":
  $type_output = '    
  &lt;option value="1"&gt;Cash&lt;/option&gt;
  &lt;option value="2"&gt;Cheque&lt;/option&gt;
  &lt;option value="3"&gt;Debit Card&lt;/option&gt;
  &lt;option value="4" selected&gt;Credit Card&lt;/option&gt;';
  break;
  }
  </code></pre>
  
  <p>html</p>
  
  <pre><code>&lt;td&gt;
  &lt;select style="width:200px;" name="payment_type"&gt;
  &lt;option value=""&gt; &lt;/option&gt;
  '.$type_output.'
  &lt;/select&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>Thank you</p>