Question: Question 3. (10 points) PHP Write the PHP code for two web pages for ordering food from an online store. The first page you will
Question 3. (10 points) PHP Write the PHP code for two web pages for ordering food from an online store. The first page you will write is a form 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: Food item milk Quantity: F0- Order The food items to list should be based on what JPG food images are available in the current directory. For example, if the current directory contains apple.jpg and steak.jpg, then "apple and "steak" appear in the drop-down list. The second page you will write is named order-submit.php. The form in order.php submits its data as a POST request to order-submit php. The output of order-submit.php is an HTML page fragment, a single paragraph indicating information about the order as described below The store's current inventory is stored in a file named inventory.txt on the server in the current directory. Each line of the file represents one item available in the store, its quantity available, and its price per unit, separated by tabs. Create your own inventory file. Here is an example inventory: apple 4 chicken 1 cookie 38 milk tomato 27 1.00 3.25 0.25 4.50 0.50 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 (you do not need to round it), and showw the user a series of images representing what was ordered. For example, if the user
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
