Salary Percentage in PHP


<!DOCTYPE html>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Salary</title>
</head>

<body>
<form action=”index.php” method=”post”>
<table cellpadding=”5″ cellspacing=”5″>
<tr>
<td><input type=”text” name=”txtSalary”></td>
<td><input type=”submit” name=”ShowSalary”></td>
</tr>
</table>
</form>
<hr>
<table cellpadding=”5″ cellspacing=”5″>
<tr bgcolor=”#6699FF”><th>Expences</th><th>Percentage</th><th>Cost</th></tr>
<?php
if(isset($_POST[‘ShowSalary’]))
{
$Salary = $_POST[‘txtSalary’];
$Home = $Salary*0.10;
$Rashan = $Salary*0.10;
$Medical = $Salary*0.5;
$Travel = $Salary*0.5;
$Education = $Salary*0.5;
$Remaining = $Salary*0.60;

$CN = mysql_connect(“LocalHost”,”root”,””);
mysql_select_db(“Salary”,$CN);
mysql_query(“insert into tblSalary values (”,’$Salary’,’$Home’,’$Rashan’,’$Medical’,’$Travel’,’$Education’,’$Remaining’)”,$CN);
mysql_close($CN);

echo”<tr><td>Total</td> <td>100$</td> <td>$Salary. Rs</td></tr>”;
echo”<tr><td>House Rent</td> <td>10%</td> <td>$Home. Rs</td></tr>”;
echo”<tr><td>Rashan</td> <td>10%</td> <td>$Rashan. Rs</td></tr>”;
echo”<tr><td>Medical</td> <td>5%</td> <td>$Medical. Rs</td></tr>”;
echo”<tr><td>Travel</td> <td>5%</td> <td>$Travel. Rs</td></tr>”;
echo”<tr><td>Education</td> <td>5%</td> <td>$Education. Rs</td></tr>”;
echo”<tr><td>Remaining</td> <td>60%</td> <td>$Remaining. Rs</td></tr>”;
}

?>
</table>
</body>
</html>

Table import it in phpmyadmin tblsalary

Advertisements

It's Great To Hear From You

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s