Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PHP help, I seem to be getting stuck with getting this program to come to life.

ID: 3886420 • Letter: P

Question

PHP help, I seem to be getting stuck with getting this program to come to life.

Create a form to allow the user to enter employee’s name, pay rate, and weekly hours work. That information will be sent to a PHP script that will process and display the employee’s paycheck information. Your assignment should have two pages. The first page is straight HTML (users_input.html) that has a form with the appropriate form elements to collect the user input. The form should then be submitted using the POST method to a PHP script (show_paycheck.php) that will process the user input.

users_input.html

The PHP script (show_paycheck.php) will receive the user input, assign it to variables, calculate and display the following pay check information:

Gross Pay (hours worked times pay rate)

Federal Taxes (10.65% of Gross Pay)

State Taxes (4% of Gross Pay)

Social Security Taxes (3.8% of Gross Pay)

Medicare (1.3% of Gross Pay)

Total Taxes (Federal + State + Social Security + Medicare)

Net Pay (Gross Pay – Total Taxes

For all the above calculations, will be assigned to variables that have descriptive names. The PHP script should calculate and display the results in the following format. The left column of the table must be bold and left justified, and the right column is right justified. There is also a link to return back to the users_input.html page.

show_paycheck.php example

lease enter employee info First Name: Last Name: Weekly Hours Worked: Hourly Rate S: Submit Reset

Explanation / Answer

// IN FILE users_input.html

<html>

<head>

<title>info </title>

</head>

<body>

<form method="POST" id="reg details" action="show_paycheck.php">

<b>Please enter employee info</b> </br>

</br></br>

First Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="fname"><br>

</br>

Last Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="text" name="lname" ><br>

</br>Weekly Hours Worked:&nbsp&nbsp<input type= "number" name="weeklyhrWork"><br>

</br>Hourly rate $:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="number" name="hrRate"><br>

</br></br>

<input type="submit" value ="Submit">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="reset" value ="Reset">

</form>

</body>

</html>

// IN FILE show_paycheck.php

<html>

<body>

<b>Paycheck Information</b>

</br>

<?php

// TAKE VALUE FROM POST AND CALCULATE IT

$lname=$_POST["lname"];

$weeklyhrWork = $_POST["weeklyhrWork"];

$fname=$_POST["fname"];

$hrRate=$_POST["hrRate"];

$grossPay = $weeklyhrWork * $hrRate;

$federalTaxes = $grossPay * 0.1065;

$stateTaxes = $grossPay * 0.04;

$ssTaxes = $grossPay * 0.038;

$medicare = $grossPay * 0.013;

$totalTaxes = $federalTaxes + $stateTaxes + $ssTaxes + $medicare;

$netPay = $grossPay - $totalTaxes;

?>

Hello <?php echo $fname ?> <?php echo $lname ?>. This week you worked <?php echo $weeklyhrWork ?> hours and, based on the

pay rate of $<?php echo $hrRate ?> per hour, your pay check information is:

</br>

//CREATE TABLE WITH BORDER

<table border="2">

<tr>

<th>GrossPay: </th>

<td>$ <?php echo $grossPay ?></td>

</tr>

<tr>

<th>Federal Taxes: </th>

<td>$ <?php echo $federalTaxes ?></td>

</tr>

<tr>

<th>State Taxes: </th>

<td>$ <?php echo $stateTaxes ?></td>

</tr>

<tr>

<th>Social Security Taxes: </th>

<td> <?php echo $ssTaxes ?></td>

</tr>

<tr>

<th>Medicare Taxes: </th>

<td>$ <?php echo $medicare ?></td>

</tr>

<tr>

<th>Total Taxes: </th>

<td>$ <?php echo $totalTaxes ?></td>

</tr>

<tr>

<th>Net Pay: </th>

<td> <?php echo $ssTaxes ?></td>

</tr>

</tabel>

</br>

//GIVE A LINK IN HREF CHANGE LINK ACCORDING TO YOUR DEPLOYMENT

<a href="http://localhost/paycheck/user_input">Return to input form </a>

</body>

</html>