Need Help with writing a simple PHP script

Not exactly sure how to script the following:

Write a PHP script that will provide a restaurant menu. The User will have the option to select one or more of the items available. Once the user has selected the item, have the user submit the form to another php script that will print the order, plus the total. Remember, to include drinks and snacks. Include limited amount of each.
Have the program calculate a total to be paid, plus tips (let tips be 8% of total)

Any help will be appreciated.

Sounds like homework. What have you tried?

Not much, dont have much experience with code like this

The assignment seems to indicate that you should have one form that lists all the possible choices. This is not how you would normally do this, since there is a limited amount of information a human is willing to view on a single web page. This would normally be done by allowing the visitor to navigate around on a web site to view the different choices and individually add them to a shopping cart. You would display the contents of the shopping cart, calculating and adding up the total, and calculating and adding the tip amount. When the visitor is finished making choices, they would proceed to a checkout phase, where the items in the cart would be persistently stored in database tables, as an order, containing the unique information about the order, and as order_items, containing the information about the items that are part of the order.

Regardless of how you design this to work, you need to first define what the work-flow is for the visitor, then for each step in that work-flow, what data is needed to produce the web page and what data will be submitted from the web page.

Once you have defined this information, you can go about designing, writing, testing, and debugging the code to produce each different web page and process any submitted form data on that page.

Sponsor our Newsletter | Privacy Policy | Terms of Service