title: Send hidden value along with drop down form data?
body: <p>I am trying to send a hidden value based on what option a user selects in a drop down menu.<br>
  Though at the moment it requires the submit button to be pressed twice.</p>
  
  <p>Is there any way I can fix this or maybe a different method I should use?</p>
  
  <p>This is what I have at the moment:</p>
  
  <pre><code>&lt;form name="input" action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;" method="get" onchange="this.form.submit()"&gt;
                  &lt;select name="myValue" value=""&gt;
                  &lt;option value="300"&lt;?php if ($_GET['myValue']==300) {echo "selected='selected'"; } ?&gt;&gt;First Option&lt;/option&gt;
                  &lt;option value="800"&lt;?php if ($_GET['myValue']==800) {echo "selected='selected'"; } ?&gt;&gt;Second Option&lt;/option&gt;
                  &lt;/select&gt;
  
  &lt;?php if ($_GET['myValue']==300) {echo "&lt;input type='hidden' name='hiddenValue' id='hiddenValue' value='123456'&gt;&lt;br /&gt;"; } ?&gt;
  &lt;?php if ($_GET['myValue']==800) {echo "&lt;input type='hidden' name='hiddenValue' id='hiddenValue' value='987456'&gt;&lt;br /&gt;"; } ?&gt;
  
  &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  
  
  &lt;?php
  echo "myValue: " . $_GET['myValue'];
  echo "&lt;br /&gt;";
  echo "hiddenValue: " . $_GET['hiddenValue'];
  ?&gt;
  </code></pre>