this is my form...
this is my savesalary.php
the data is not storing into the salary table... why?
Code:
<form action="savesalary.php" method="post">
<table width=100% border=0 bordercolor="#CC6633">
<tr>
<tr>
<td>Employee Id: </td>
<?php
$empid=$_GET['id'];
print"<td><input type='text' name='empid' value='$empid'></td>";
?>
</tr>
<tr>
<td>No of Days in Month: </td>
<td>
<input type='text' name='ndm'>
</td>
</tr>
<tr>
<td>No of Days Present: </td>
<td>
<input type='text' name='ndp'>
</td>
</tr>
<tr>
<td>Week Offs: </td>
<td>
<input type='text' name='woffs'>
</td>
</tr>
<tr>
<td>Additions: </td>
<td>
<input type='text' name='add'>
</td>
</tr>
<tr>
<td>Deductions: </td>
<td>
<input type='text' name='ded'>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Send"></td>
</tr>
this is my savesalary.php
Code:
<?php
include("config.php");
$empid=$_POST['empid'];
$query="SELECT * FROM employee WHERE empid='$empid'";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num)
{
$fsal = mysql_result($result, $i,"fsal");
$i++;
}
$empid=$_POST['empid'];
$ndm=$_POST['ndm'];
$ndp = $_POST['ndp'];
$woffs= $_POST['woffs'];
$add = $_POST['add'];
$ded = $_POST['ded'];
$month = date ("M-Y");
$tdaysp = ($ndp)+($woffs);
$ds = ($fsal/$ndm);
$t = ($ds)* ($tdaysp);
$total = ($t)+($add)-($ded);
$sal= round($total);
$query1 = "insert into salary (empid, ndm, ndp, woffs, add, ded, month, total)
values ('$empid', '$ndm' ,'$ndp','$woffs' ,'$add','$ded','$month','$sal')";
mysql_query($query1);
//print "Data Updated Sucessfully";
?>
the data is not storing into the salary table... why?
Comment