Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need some help with a PHP program two part i have the index.php part completed : Here is the form that needs the user

i need some help with a PHP program two part i have the index.php part completed :

Here is the form that needs the user to enter in the information then display the tax and the subtotal and total :

image text in transcribed

where i create a php code block at the beginning of this document with if statements that use the !isset() built-in function to set the default value of the variables ($cust_fName, $cust_lName, $labor_costs, $parts_cost) to an empty string ( ) if the variables do not exist, specifically the first time the page loads. Just inside of the body, you will need to add another php statement with an if loop that uses the !empty() function to determine if the $error_message is not empty in which case it will echo the contents of the $error_message variable. Use echo statements within the value attributes of the tags for the text boxes. These echo statements should display the values in the variables from the php code block at the beginning of the page. Be sure to use the htmlspecialchars() function in your echo statements to escape the output before it is sent to the browser. After adding php blocks to your html document it is necessary to save it as a php file type.

my Code for index.php

Future Value Calculator

Future Value Calculator

Now i need some help with the calculations on display_invoice.php as follows :

The php block at the beginning of the document will contain five parts. The first part gets the data from the form by using the filter_input() function to access the POST request. The second part uses one long if/else if statement to validate all four user entries. All four fields are required. $labor_costs and $parts_cost must be valid floats and they must be greater than zero. Dont forget to include a final else statement that sets $error_message equal to an empty string. The third section is an if statement that reloads the index.php page if an error message was generated in the second section. The next section is where the math takes place. Use the define() function to create a constant TAX_RATE equal to .0925 or 9.25%. You will need variables called: $subTotal, $total, $sales_tax. The final section of the php block formats the display so that all amounts print in currency format, and concatenate the $cust_fName and $custlName with a space between them into a variable called $f_cust_name. In the body of the document use echo statements to display the customer name, parts cost, labor costs, subtotal, sales tax, and total within the tags. here is the html :

Invoice Calculator

Dooley's Automotive

Dooley's Automotive Customer First Name: Customer Last Name: Labor Costs Parts Cost: Display Invoice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions