baby83 Posted March 30, 2008 Share Posted March 30, 2008 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> Quote Link to comment Share on other sites More sharing options...
baby83 Posted March 30, 2008 Author Share Posted March 30, 2008 please... can anybody help me... Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted March 30, 2008 Share Posted March 30, 2008 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 Quote Link to comment Share on other sites More sharing options...
baby83 Posted April 1, 2008 Author Share Posted April 1, 2008 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) Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 1, 2008 Share Posted April 1, 2008 What do you actually wish to do with the data? At the moment, the query you're trying to do doesn't make much sense. Do you want to update an existing row with some data? Or just create a new row? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.