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
https://forums.phpfreaks.com/topic/98588-i-dont-know-how-to-calculate/
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

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)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.