Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the PHP code for two partial webpages for ordering food from an online store. The first page you will write is a form in

Write the PHP code for two partial webpages for ordering food from an online store. The first page you will write is a form in a page named order.php that allows the user to choose what kind of food to buy and how many to buy. In your form, include a drop-down menu of food items available. Include a text box for the user to enter a quantity of the item to purchase (2-characters-wide), and an "Order" button to submit the form. The form should look like this:

image text in transcribed

In general your task is to look up the price per unit of the item the user is ordering, and use this price to compute the total order cost. For example, if the item costs $0.50 and the user orders 7 of them, the total order is 7 * 0.50 = $3.50. The page's output in the general successful case is to inform the user that the order was successful, display the total order cost. The store is only able to complete an order if that food item is in the inventory and the store has enough of that item in stock. For example, if the inventory has 9 'milk' in stock and the user tries to order 10 of 'milk', the following error should be displayed: If an item is not present in the inventory file, assume that its quantity available in stock is 0 and display the same sort of error message. You do not need to modify the inventory database or update its quantity of the item being ordered. If the food item or quantity parameters are not passed, issue an HTTP 400 error. If they are present, you may assume that the food item value passed is a string and the quantity value passed is a positive integer.

Food item: Quantity

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

More Books

Students also viewed these Databases questions