Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6988287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:03:36+00:00 2026-05-27T19:03:36+00:00

I want to create a php variable depending on what was selected in a

  • 0

I want to create a php variable depending on what was selected in a drop down.

This is the drop down:

  <td width="5" rowspan="2"><select id="ddlTime">
      <option selected="selected" value="perhour" name="perhour">per hour</option>
      <option value="perannum" name="perannum">per annum</option>
    </select></td>

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):

// 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;

How can this be done?

Here’s my full form:

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

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:03:37+00:00Added an answer on May 27, 2026 at 7:03 pm
    <select id="ddlTime" name="ddlTime">
    

    and

    if( $_POST['ddlTime']=='perhour' ){
        // if per hour is selected:
        $result_pharmacist = $_POST["pharmacist"];
        $result_dispenser = $_POST["dispenser"];
    }elseif( $_POST['ddlTime']=='perannum' ){
        // 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;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a CAPTCHA similar to http://www.gigbooks.com/getcaptcha.php this one. But its in
Using this function I want to create a PHP navigation: function loadPage($pagename) { if
I want to create a PHP file with $_GET[] function like this: http://mywebsite.com/account.php?register ->
I want to create a PHP app that can send text messages ; There
I want to create a static class in PHP and have it behave like
I want to create a command line program using PHP. How do I design
I want to create an HTTPURLConnection to a PHP script and get the HTTP
I want to create sub-domains using PHP on the fly. Suppose a user registers
I want to create a cookie using php,an also i need to read it
I want to create a file on the webserver dynamically in PHP. First I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.