| CS 199 | Willamette University | Spring, 2019 |
|
Programming in PHP, Databases with MySQL, and Web Applications |
||
This lab suggests one type of application of forms and PHP programming. The work here is limited in scope. Further, since this project collects no personal data, the application largely avoids many issues of privacy and security. Hopefully, work on this project may provide insights about approaches that might be considered for more realistic applications.
The Pretty Healthy Pickle is a fictitious restaurant, located at 199 Walker Avenue and serving a pickle with each luncheon entree, so its well-known abbreviation is PHP-199. To reduce lines at lunch, patrons may order their luncheon options online, based on the following somewhat-quirky menu:
| Bread | |||
|---|---|---|---|
| •Wheat ($0.75) | •White ($0.75) | •Sour Dough ($.85) | •Croissant (0.95) |
| Diet Category | |||
| •Carnivore ($3.50) | •Vegetarian ($2.75) | •Vegan ($3.00) | |
| Vegetables ($0.40 each) | |||
| •Carrot slices | •Green pepper | •Jalapenos | •Ketchup |
| •Lettuce | •Mushroom | •Mustard | •Onion |
| Type of Pickle | |||
| •Candied | •Dill | •Gherkin | •Sweet |
| Customer Details | |||
| Name for order pickup: | Price paid (before change) | ||
Of course, a real restaurant might expand some of these categories and add types of cheese, options for sauces, etc., but the above menu might provide a starting place.
Within this menu:
A patron would select one type of bread, one diet category, and one type of pickle. (Each of these sections should have their own set of radio buttons in html).
Patrons can select any combination of vegetables, noting that each selection costs an additional $0.40. (Each option should utilize a checkbox in html.)
The total cost of a luncheon selection is determined by adding the selections for the bread selection, the Diet Category selection, and the number of vegetables desired.
In ordering, the restaurant must know who ordered what, so the customer must indicate a name they will use in picking up the order.
To facilitate the transaction, the patron must indicate what they will be offering for payment (e.g., a $20 dollar bill, 1492 pennies (entered as 14.92), etc.). Of course, the restaurant will return a proper amount of change when the patron picks up the order.
After submitting the form, PHP processing on the server should display the following:
The bread, Diet Category, and Pickle selections.
An itemized list of the vegetables selected (omitting mention of those not selected).
The cost of the lunch ordered.
The name for the order pickup.
The amount of change to be returned. (If the amount indicated by the customer is insufficient to cover the cost, the patron should be asked to use the back button to return to the order page and then enter a larger amount.)
Implement both the Web page for the menu form and the PHP/HTML page that generates the response page, and use Cascading Style Sheets to add color and style in the format of each page.
The menu-form page should include these elements:
The PHP/HTML page should include the following information:
|
created 4 February 2019 revised 4 February 2019 |
|