Jump to content

i dont know how to calculate...


baby83

Recommended Posts

i have this code... for user to enter the input...

but i dont know how to calculate the salary... which is...

basic + allowance=salary.

after the calculation, i want to insert all the inserted input into the database...

can anybody help me? i'm new... :(

 

<tr>

        <td>Name</td>

        <td><input type="text" name="name"></td>

        <td>IC</td>

        <td><input type="text" name="ic"></td>

      </tr>

        <tr>

        <td width="132">Basic</td>

        <td width="144"><input type="text" name="basic"></td>

        </tr>

          <tr>

        <td>Allowance</td>

        <td><input type="text" name="allowance"></td>

 

Link to comment
Share on other sites

1.) This isn't really maths based. If the addition of two variables were counted as maths based programming, then every topic would be here

2.) There's absolutely no need to bump a topic after one hour - it was probably still the first topic anyway!

3.) You've shown us your HTML code - do you have any PHP code as well? Or as you asking someone to do this for you?

 

If you do have some knowledge of PHP, then this tutorial on form processing may be of use to you:

 

http://www.rbredlau.com/drupal/node/10

Link to comment
Share on other sites

this is part of my php...

 

if ($_POST['submit'] == "Calculate")

{

$basic = $_POST['basic'];

$allowance = $_POST['allowance'];

 

$link = mysql_connect("localhost", "root", "") or die(mysql_error());

    mysql_select_db("SLIP") or die (mysql_error());

sql="SELECT basic+allowance AS salary FROM try";

          $result_update = mysql_query($sql) or die(mysql_error());

    $row = mysql_fetch_array($result_update);

}

 

is it ok? actually i'm not really good in php but i want to try to do it... can u help me?

i wish to do a simple calculation... which is.... basic+allowance=salary... and send it to the database (SLIP)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.