title: How to post two values in an option field?
body: <p>I'd like to post two values in one drop down option and I'm not sure about the best way to approach it.</p>
  
  <p>The drop down list pulls data in from an external service. This data is 'id' and 'name'.</p>
  
  <p>When I select an option in the drop down and then press submit I want the 'id' and the 'name' to be posted.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>&lt;select name="data"&gt;
  &lt;option&gt;Select a name&lt;/option&gt;
  &lt;?php foreach($names as $name): ?&gt;
      &lt;option value="&lt;?php echo $name['id']);?&gt;"&gt;
         &lt;?php echo $name['name']);?&gt;
      &lt;/option&gt;               
  &lt;?php endforeach; ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I've tried putting in a hidden input field, but that then doesn't render out the drop down (instead it just creates a list).</p>
  
  <p>I am using both the id and name elsewhere, so I don't want to have to post just the id and then have to get the name again, hence I want to post both of them at the same time.</p>
  
  <p>Any recommendations?</p>