Check drop down and create if statement based on that selection
<p>I want to create a php variable depending on what was selected in a drop down.</p>

<p>This is the drop down:</p>

<pre><code>  &lt;td width="5" rowspan="2"&gt;&lt;select id="ddlTime"&gt;
      &lt;option selected="selected" value="perhour" name="perhour"&gt;per hour&lt;/option&gt;
      &lt;option value="perannum" name="perannum"&gt;per annum&lt;/option&gt;
    &lt;/select&gt;&lt;/td&gt;
</code></pre>

<p>Depending if "per hour" or "per annum" was selected, I want to do the following (I'm not quite sure syntax wise if this is correct and this part is on another page):</p>

<pre><code>// if per hour is selected:
$result_pharmacist = $_POST["pharmacist"];
$result_dispenser = $_POST["dispenser"];

// if per annum is selected:
$user_pharmacist = $_POST["pharmacist"];
$result_pharmacist = $user_pharmacist/37.5/52;
$user_dispenser = $_POST["dispenser"];
$result_dispenser = $user_dispenser/37.5/52;
</code></pre>

<p>How can this be done?</p>

<p>Here's my full form:</p>

<pre><code>&lt;form action="&lt;?php the_permalink(); ?&gt;calculations" method="post"&gt;
  &lt;h2&gt;Savings calculator&lt;/h2&gt;
  &lt;div class="calculator-divide"&gt;&lt;/div&gt;
  &lt;table border="0"&gt;
    &lt;tr&gt;
      &lt;td colspan="3"&gt;&lt;h3&gt;Current service costs&lt;/h3&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width="440"&gt;&lt;p&gt;Pharmacist&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p style="padding-left:5px!IMPORTANT;"&gt;&amp;pound;
          &lt;input style="width:145px!IMPORTANT;" value="22.00" type="text" name="pharmacist" /&gt;
        &lt;/p&gt;&lt;/td&gt;
      &lt;td width="5" rowspan="2"&gt;&lt;select id="ddlTime"&gt;
          &lt;option selected="selected" value="perhour" name="perhour"&gt;per hour&lt;/option&gt;
          &lt;option value="perannum" name="perannum"&gt;per annum&lt;/option&gt;
        &lt;/select&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;Dispenser / Technician&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p style="padding-left:5px!IMPORTANT;"&gt;&amp;pound;
          &lt;input style="width:145px!IMPORTANT;" value="8.00" type="text" name="dispenser" /&gt;
        &lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan="3"&gt;&lt;h3&gt;Time taken to carry out manual dispensing tasks&lt;/h3&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;Measure 50mls dose by hand including Pharmacist check&lt;/p&gt;&lt;/td&gt;
      &lt;td colspan="2"&gt;&lt;p style="padding-left:5px!IMPORTANT;"&gt;
          &lt;input value="1" type="text" name="measure-check" /&gt;
          Minute(s)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;Preparing labels from dispensary system&lt;/p&gt;&lt;/td&gt;
      &lt;td colspan="2"&gt;&lt;p style="padding-left:5px!IMPORTANT;"&gt;
          &lt;input value="0.5" type="text" name="labels" /&gt;
          Minute(s)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;Write up CD register&lt;/p&gt;&lt;/td&gt;
      &lt;td colspan="2"&gt;&lt;p style="padding-left:5px!IMPORTANT;"&gt;
          &lt;input value="2" type="text" name="cd-register" /&gt;
          Minute(s)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td colspan="3"&gt;&lt;div class="estimate"&gt;
          &lt;input style="margin-bottom:20px;" type="submit" value="Estimate my savings" /&gt;
        &lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/form&gt;
</code></pre>
