Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need to create a php code block at the beginning of this document with if statements that use the !isset() built-in function to set the

need to 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.

Open the display_invoice.php file. 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.

image text in transcribed

here is the html index.php:

?>

Invoice Calculator

Dooley's Automotive

here is Display_invoice.php:

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

Step: 3

blur-text-image

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

What are the main objectives of Inventory ?

Answered: 1 week ago

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago