title: How to change value in input (textbox) by changing select
body: <p>I'm trying to change the value in an input when a different option gets selected from a select:</p>
  
  <p><a href="http://s1097.photobucket.com/albums/g351/europcsolutions/?action=view&amp;current=ad-package.jpg" rel="nofollow">View image here.</a></p>
  
  <p>The idea is that for each ad package you can have a different number of images (free gets 0 images, $20 for 4 images etc.). With this number I then want to display the correct amount of upload fields for images.</p>
  
  <p>I'm already retrieving the values from the database for the number of images for each package as you can see in the code below:</p>
  
  <pre><code>&lt;select name="ad_pack_id" class="dropdownlist required"&gt;
  
  &lt;?php foreach ( $results as $result ) { ?&gt;
  
  &lt;option value="&lt;?php esc_attr_e($result-&gt;pack_id); ?&gt;" class="&lt;?php esc_attr_e($result-&gt;pack_images); ?&gt;"&gt;&lt;?php esc_attr_e($result-&gt;pack_name); ?&gt;&lt;/option&gt;
  
  &lt;?php } ?&gt;
  
  &lt;/select&gt;
  
  &lt;input type="hidden" value="" name="packimages" id="packimages" /&gt;
  </code></pre>
  
  <p>I've tried getting the value from the select directly by doing:</p>
  
  <pre><code>mainform.ad_pack_id.options[selectedIndex].class.innerHTML
  </code></pre>
  
  <p>but this isn't getting the number of images.</p>
  
  <p>How can I get the number of images for the selected ad package without submitting the form first?</p>