Hello to all developers!
I am a basic in php. i must present a practice in class. it contains a code with a simple html form & php function that send some fields (about salary & payment). php function must calculate the amount of salary and show it on browser. Also php send information in form to mysql database.
I use xampp (local host program) and can make html form wit php script for sending data to my sql but i cant write php code for calculating salary & show on browser when submit button is click.
description of Variable in form:
$BasicSalary means regular payment
$Housing means pay for rent a house
$Overtime means hours you stay in office and do unfinished task
$businessHours means regular hours for work in a office
$FractionHours means hours you left work at office
$all-Overtime and $all-Fraction are php function that calculate amount of salary!
please help me to make these code. i attach error picture & file codes.
i apologize error picture is in persian language just look below picture at error “echo” 0 . 0 . 0 !!
[php]
payment<form method="post" action="">
<p>firs name</p>
last name
Basic Salary
food pay
Over time Hours
business pay per Hour
Fraction Hours
<?php $BasicSalary = ""; $Housing = $sabet/10; $Overtime = ""; $businessHours= ""; $FractionHours = ""; $all-Overtime = $FractionHours*$businessHours*(1/4); $all-Fraction = $FractionHours*$businessHours;
function registeruser($Fname, $Lname, $sabet, $food, $ezafekar, $saatkar, $saatkasr){
$con = mysqli_connect(‘localhost’,‘root’,’’);
mysqli_select_db($con,‘salary’);
mysqli_query($con,"INSERT INTO payment(Fname, Lname, sabet, food, ezafekar, saatkar, saatkasr)
VALUES('$Fname', '$Lname', '$sabet', '$food', '$ezafekar', '$saatkar', '$saatkasr');");
echo mysql_error();
}
if(isset($_POST[‘submit’]))
{
registeruser($_POST[‘Fname’],$_POST[‘Lname’],$_POST[‘sabet’],
$_POST[‘food’],$_POST[‘ezafekar’],$_POST[‘saatkar’],$_POST[‘saatkasr’]);
echo "$home .$Uptime .$kasreKar";
}
?>
</body>
[/php]
CSS CODES!
[embed=425,349]x
body
{
background:#669900;
font-family:“Lucida Grande”, Tahoma, Arial, Verdana, sans-serif;
font-size:small;
margin:8px 0 16px;
text-align:center;
}
[/php]