title: Pre-select option matching db value without adding a new Select option
body: <p>I am creating a customer account page which displays the relevant information in the database and allows customers to edit their information.   </p>
  
  <p>The code below retrieves and displays the customer's account information from the database and pre-selects the values matching their information correctly. My problem is specific to Select elements - instead of selecting from amongst the existing select options it’s adding an extra select option with the value in the database, so that the value that’s in the database is displayed twice. </p>
  
  <p><strong>Edit -</strong> For example, if the db value for 'gift_privacy' is 'Standard', the Select options are being displayed as: *Standard, Standard, Gift ID Req, Not_Enrolled* instead of *Standard, Gift ID Req, Not_Enrolled*</p>
  
  <p>How can I correct this code so that <code>selected="selected"</code> is applied to the existing options? </p>
  
  <pre><code>&lt;?php   
  try {  
  $stmt = $conn-&gt;prepare("SELECT * FROM customer_info WHERE user_id = :user_id");  
  $stmt-&gt;bindValue(':user_id', $user_id); 
  $stmt-&gt;execute();
  }catch(PDOException $e) {echo $e-&gt;getMessage();}
  $row = $stmt-&gt;fetch();
  $search = array('_', ',');
  $replace = array(' ', ', ');
  $rows = str_replace($search, $replace, $row);
  ?&gt;
  &lt;select name="gift_privacy"&gt;
  &lt;option selected="selected" value="&lt;?php echo $rows['gift_privacy']; ?&gt;"&gt;&lt;?php echo $rows['gift_privacy']; ?&gt;&lt;/option&gt;
  &lt;option value="Standard"&gt;Standard&lt;/option&gt;
  &lt;option value="Gift_ID_Req"&gt;Require program ID&lt;/option&gt;
  &lt;option value="Not_Enrolled"&gt;Do not enroll&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>