Create an HTML header file based on the header.html file used in ch03. Save the file as myheader.html in the following path on your webserver: c:/htdocs/ch03/includes. Edit the content for the H1 tag...

1 answer below »



  1. Create an HTML header file based on the header.html file used in ch03. Save the file as myheader.html in the following path on your webserver: c:/htdocs/ch03/includes. Edit the content for the H1 tag to show ITP225. Edit the content for the h2 tag to show your name. Edit the 1st hyperlink in the Navigation bar to point to a myindex.php file that will be created in this assignment. Edit the 2nd hyperlink in the Navigation bar to link to a phpPaycheck3.php that will be created in this assignment. Edit the content to read Paycheck Calculator3. Add links to the MyNOVA website for the 3rd link in the navigation bar. Add links to the PHP.net manual at www.php.net for the 4th link in the navigation bar. Add links to the W3Schools tutorials at www.w3schools.com for the 5th link in the navigation bar. You can test the header.html file, but you will not see the effects of the styles.css sheet as the header.html file is not meant to be viewed by itself. It is meant to be included within other PHP files. Once you create the myindex.php file, the header will be included within it and will style according to the style.css style sheet. Test the links to MyNOVA, PHP.net manual, and W3Schools Tutorials to make sure that they work.(1 Point)




  2. Create an HTML footer file based on the footer.html file used in ch03. Save the file as myfooter.html in the following directory path: c:/htdocs/ch03/includes. Replace the content with the following: your name | Current Date | PHP Chapter 03. Once again, you can test the footer.html file, but will not see the effect of the style.css stylesheet until the footer is included within other PHP files. (1 Point)




  3. Create a myindex.php file based on the index.php file used in ch03. Save the file as myindex.php in the following path: c:/htdocs/ch03. See screenshot 1 above for what it should look like at this point. Replace the content with the following: This is my main page. Click on the links in the navigation bar above to see some of my work or links about the PHP programming language. Learning PHP, like any programming language can best be summed up by these quotes: "The three great essentials to achieve anything worthwhile are, first, hard work, second, stick- to-itiveness; third, common sense." Thomas Edison "There are no shortcuts to any place worth going." Beverly Sills "Don't wish it were easier. Wish you were better." Jim Rohn "I was a Computer Science major. I got out once it got really hard. I made it up to C++. Then I couldn't do the math – it got really confusing. I switched to Communications, which is a ridiculous major – let's be honest," Jimmy Fallon.(2 Points)




  4. Create a PHP file called phpPaycheck3.php in the c:/htdocs/ch03/ directory on your webserver. The phpPaycheck3.php file is based on several features used in the calculator.php file used in Ch03. The phpPaycheck3.php must include a sticky HTML form at the top of the page that allows the user to input the First Name, Last Name, Hours Worked, and Hourly Rate. The first time that the user visits the phpPaycheck3.php file and if the user does not enter the required data, only the sticky form will be displayed. Within the sticky HTML form, do not state that any of the input values are required and do not state the minimum and maximum values for Hours Worked or Hourly Rate. After the user submits the form with correct entries, the phpPaycheck3.php file processes First Name, Last Name, Hours Worked, and Hourly Rate using the POST method and outputs the table showing the paycheck calculations. The application calculates and displays the Regular Pay, Overtime Pay, Gross Pay, FICA Tax Withheld, State Tax Withheld, Federal Tax Withheld, Total Taxes, and Net Pay. The FICA Tax Rate, State Tax Rate, Federal Tax Rate, and Employee Name are also displayed. Save the file as phpPaycheck3.php and store it in your ch03 directory on your personal web server. (2 Points)




  5. Style the table within phpPaycheck3.php file using CSS. For my solution, I modified the CSS code used in the CSS fancy table example at the W3Schools website: http://www.w3schools.com/css/tryit.asp?filename=trycss_table_fancy. I changed the green colors used in backgrounds and borders to shades of blue and white. I used the styles.css file used in the Ch02 PHP assignment for formatting the table. (2 Points)




  6. The myindex.php and phpPaycheck3.php files must be free of errors that are throwing error messages with line numbers when viewed in the web server. If you submit a PHP file that has errors within it causing error messages and line numbers to appear and no output to be displayed, you will lose 10 points off of this




assignment. I will debug and correct the first 5 errors for you when giving feedback, but I will not debug beyond your first 5 errors. In summary, you will lose 10 points off of the final grade for not debugging the PHP file. (10 Points)




  1. Once you have output, the resulting HTML code from the phpPaycheck3.php file must be validated. Please see the additional document entitled FirefoxTidyHTMLValidator on how to use a validator that works as an add-on within a browser. Search in google for an HTML Validator that works with the browser of your choice. I will validate it with Firefox’s Tidy HTML Validator when grading. (1 Point)




  2. The phpPaycheck3.php file must meet the following specifications (30 Points Total as broken down below):




    1. Input variables for the First Name, Last Name, Hours Worked, and Hourly Rate are submitted from the form section contained within the phpPaycheck3.php file and processed by the phpPaycheck3.php file


      using the POST method. See Page 93 Lines 33 and 34 for how to specify the POST method and code a


      text box as a sticky text box. (1 Point)




    2. Check for form submission by using the ($_SERVER[‘REQUEST_METHOD’] as shown on Line 7 on Page


      92. The if statement testing form submission ends at Line 27 on Page 92. (1 Point)




    3. Validate that First Name is entered. If not, display a message that says “You must enter your First Name to be paid.” See screenshot 2 above. You can use the empty() function as shown in Chapter 02 in Pages


      49-53, or you can also use the isset() function as shown in Chapter 02 Pages 49-53 and Chapter 03 Pages


      92-94. (1 Point)




    4. Validate that Last Name is entered. If not, display a message that says “You must enter your Last Name


      to be paid.” See screenshot 3 above. You can use the empty() function as shown in Chapter 02 in Pages 49-53, or you can also use the isset() function as shown in Chapter 02 Pages 49-53 and Chapter 03 Pages 92-94. (1 Point)




    5. Validate that Hours Worked is entered and is between 0 and 80. If not, display a message that says “You must enter Hours Worked that is between 0 and 80.” See screenshot 4 above. You can use the empty() function as shown in Chapter 02 in Pages 49-53, or you can also use the isset() function as shown in Chapter 02 Pages 49-53 and Chapter 03 Pages 92-94. (2 Points)




    6. Validate that Hourly Rate is entered and is between 0 and 100.00. If not, display a message that says “You must enter an Hourly Rate that is between 7.25 and 100.00.” See screenshot 5 above. You can use the empty() function as shown in Chapter 02 in Pages 49-53, or you can also use the isset() function as shown in Chapter 02 Pages 49-53 and Chapter 03 Pages 92-94. (2 Points)




    7. If one or more of the above conditions are not met, display a message that says “Please fill out the fields as required and submit again.” See screenshot 6 above. See Chapter 03 Pages 92 lines 22-25 for an idea on how to complete this requirement. (1 Point)




    8. FICA Tax Rate of 5.65% is defined as a constant. Remember that percentages are actually decimals. Hint for a later function...you have just created a CONSTANT which is a literal and global to your script. (1 Point)




    9. State Tax Rate of 5.75% is defined as a constant. Remember that percentages are actually decimals. Hint for a later function...you have just created a CONSTANT which is a literal and global to your script. (1 Point)




    10. Federal Tax Rate of 28.00% is defined as a constant. Remember that percentages are actually decimals. Hint for a later function...you have just created a CONSTANT which is a literal and global to your script. (1 Point)




    11. Regular Pay will be correctly calculated as up to 40 Hours Worked * Hourly Rate and formatted with the number_format() function as shown. (1 Point)




    12. Overtime Pay will be correctly calculated as Hours Worked over 40 * Hourly Rate * 1.5 and formatted with the number_format() function as shown. (1 Point)








  1. Gross Pay will be correctly calculated as Regular Pay + Overtime Pay and formatted with the number_format() function as shown. HINT for a later function...you have just created a global variable for Gross Pay. (1 Point)




  2. FICA Tax Rate will be correctly displayed. (1 Point)




  3. Create a function calledl calculate_taxes_withheld that will take two arguments, gross pay, and a tax


    rate. For the arguments, do not use your global variable representing gross pay as explained by the author on Page 109 or any of your CONSTANT names. The function should include an equation to calculate taxes withheld. The function should format taxes withheld with the number_format function displaying 2 decimal places. The function can return taxes withheld. See lines 24-35 on Page 106 for a function similar to what you are creating. (5 Points)




  4. Calculate the FICA Tax Withheld by calling the calculate_taxes_withheld function and supplying your Gross Pay global variable and FICA Tax Constant to it as arguments/parameters . See line 48 on Page 106 for something similar to what you need to do. The difference being that you have a global variable representing Gross Pay and you have a Constant representing FICA Tax so you don’t have to use anything $_POST . Just use the Global variable name that represents your Gross Pay and the Constant name that represents the FICA tax rate.(1 Point)




  5. State Tax Rate will be correctly displayed. (1 Point)




  6. Calculate the State Tax Withheld by calling the calculate_taxes_withheld function and supplying your


    Gross Pay global variable and State Tax Rate Constant to it as arguments/parameters. (1 Point)




  7. Federal Tax Rate will be correctly displayed. (1 Point)




  8. Calculate the Federal Tax Withheld by calling the calculate_taxes_withheld function and supplying your


    Gross Pay global variable and Federal Tax Rate Constant to it as arguments/parameters. (1 Point)




  9. Total Taxes will be correctly calculated as FICA Tax Withheld + State Tax Withheld + Federal Tax


    Withheld and formatted with the number_format() function as shown. (1 Point)




  10. The Employee Name will be correctly displayed by concatenating the First Name and Last Name. (1


    Point)




  11. The Net Pay will be correctly calculated as Gross Pay – Total Taxes and formatted with the


    number_format() as shown. (1 Point)




9. Submit the myheader.html, myfooter.html, myindex.php, and phpPaycheck3.php files and any supporting .css


files to Blackboard. (1 Point)


Helpful Hints:




  1. The most helpful resources to review for completing this assignment (besides the phpPaycheck2.php file from Week 10) are


    the header.html, footer.html, index.php, and calculator.php files. Much of the data validation demonstrated on Pages 49-53


    or Pages 92-93 in your textbook will assist.




  2. Sticky forms are covered on Pages 92-93.




  3. The function most similar to the one you are creating is covered on Pages 105-109. Be sure to read about why you shouldn’t


    use global variables in your functions on Page 109.




  4. On Page 57, the second to last tip on the page can save you a lot of aggravation when coding. Basically, the author is


    directing you to save a superglobal array value posted from the form into a variable as in $name=$_POST[‘name’] so that you don’t have to keep repeating $_POST[‘name’] in your code. After saving $_POST[‘name’] into $name, you can refer to $name from that point forward.




  5. Remember that parse errors are usually the result of mismatched (), [], {}, “”, or ‘’. They should normally be paired up. I use the Find feature in my text editor to count all of the ( entered and then count all the ) entered. Unless you had need for an escape sequence, the counts should be the same. I repeat for the other brackets and double and single quotation marks.




  6. Don’t try to code the whole program at once. Break it into smaller programs in a logical manner. When I completed my solution, I began by copying the phpPaycheck2.html form content into the phpPaycheck3.php file similar to what the author shows on Page 93. Then, I added the sticky form code for each text box. Then I added the code for checking the form submission as shown on Lines 6,7, and 27. Then, I worked on my validations. After getting First Name to validate correctly, I worked on the Last Name, etc. I made sure that I had correct output by using the previous calculations and table from Week 10 before I created the calculate_taxes_withheld function and its associated calls.



Answered Same DayJul 17, 2022

Answer To: Create an HTML header file based on the header.html file used in ch03. Save the file as...

Anurag answered on Jul 18 2022
63 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here