title: PHP - PRE-select drop down option
body: <p>Using the example at the following URL: <a href="http://www.kavoir.com/2009/02/php-drop-down-list.html" rel="noreferrer">http://www.kavoir.com/2009/02/php-drop-down-list.html</a></p>
  
  <p>How can I have that drop down menu pre-select one of the options such as 'Apple'?</p>
  
  <p>EDIT: Addition info</p>
  
  <pre><code>function showForm()
  
  {
  global $sProduct, $name, $product, $header_file, $footer_file, $form_width, $form_background, $form_border_color, $form_border_width, $form_border_style, $cell_padding, $left_col_width, $font_size;   
  include $header_file; 
  echo &lt;&lt;&lt;EOD
  
  &lt;form method="post" class="cForm"&gt;
  &lt;table style="width:{$form_width}; padding:20px 7px 0px 7px; font-size:{$font_size}; background-color:{$form_background};" class="contactForm"&gt;
  &lt;tr&gt;
  &lt;td style="width:{$left_col_width}; text-align:left; vertical-align:center; padding:{$cell_padding}; font-weight:bold; {$name[3]}"&gt;{$name[0]}&lt;/td&gt;
  &lt;td style="text-align:left; vertical-align:top; padding:{$cell_padding};"&gt;&lt;input type="text" name="{$name[1]}" value="{$name[2]}" size="25"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td style="width:{$left_col_width}; text-align:left; vertical-align:center; padding:{$cell_padding}; font-weight:bold;"&gt;{$product[0]}&lt;/td&gt;
  &lt;!--&lt;td style="text-align:left; vertical-align:top; padding:{$cell_padding};"&gt;&lt;select name="{$product[1]}"&gt;--&gt;
  &lt;td style="text-align:left; vertical-align:top; padding:{$cell_padding};"&gt;
  &lt;select name="{$product[1]}"&gt;
      &lt;option value="1"&gt;&lt;/option&gt;
      &lt;option value="2"&gt;item 2&lt;/option&gt;
      &lt;option value="3"&gt;item 3&lt;/option&gt;
      &lt;option value="4"&gt;item 4&lt;/option&gt;
      &lt;option value="5"&gt;item 5&lt;/option&gt;
      &lt;option value="6"&gt;item 6&lt;/option&gt;
  &lt;/select&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;td style="width:{$left_col_width}; text-align:left; vertical-align:center; padding:{$cell_padding}; font-weight:bold; {$code[3]}"&gt;{$code[0]}&lt;/td&gt;
  &lt;td style="text-align:left; vertical-align:top; padding:{$cell_padding};"&gt;&lt;input type="submit" name="submit" value="Submit" style="border:1px solid #999;background:#E4E4E4;" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td colspan="2" style="font-size:10px; text-align:left; vertical-align:middle; padding:{$cell_padding};"&gt;
  0:(var_product[0] = ({$product[0]})) &lt;br/&gt;
  1:(var_product[1] = ({$product[1]})) &lt;br/&gt;
  2:(var_product[2] = ({$product[2]}))&lt;br/&gt;
  3:(var_product[3] = ({$product[3]}))&lt;br/&gt;
  4:(var_sProduct = ({$sProduct}))&lt;br/&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  
  EOD;
  </code></pre>