Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Topic: Fun With Forms. Read these directions carefully . This may take longer than you think. Start early. Our users can send info to

Program Topic: Fun With Forms.

Read these directions carefully. This may take longer than you think. Start early.

Our users can send info to our web server using a link and a GET request, but much of the time we will need a HTML form. The html form is essentially our client's user interface and we will use forms to one degree or another throughout the semester. So, our first program is to refresh our memories on how HTML forms are constructed and submitted to a web server and how that information is retrieved in a php file. It all starts with input.

We are going to create a pizza order form. Create a HTML form with the following elements. Except for the hidden textbox, each form element should have an associated HTML label for it. Your form will need:

  • a textbox for the name and a textbox for an address
  • a password field (even though we are not making use of it for this program)
  • a hidden text field with a value = "rush order"
  • a drop-down list (a select element) with these options. Based on pizza size, this is the cost of a cheese pizza without toppings.
    • 10 in. $6
    • 14 in. $10
    • 18 in. $14
  • 4 checkboxs, each with the same name, that offer a possible topping. add 1$ per topping.
  • 2 radio buttons in a group. The delivery option adds $5
  • a text area for the user to add any extra info necessary. the user is not required to type anything here.
  • a submit and reset button


You may style (or not) the form and the order summary it produces any way you want, but it needs to be easy to use and read. Here is an image of a possible layout (although the hidden field is not shown, of course).


As with any assigned program, do not wait until the last minute to start. Start early in the week the program is due so you can ask questions if you get stuck.

Your project folder needs to contain 2 files. The first page is the pizza order form shown above, the second page is a php page to process the order and sends a summary page to the user.

I recommend using the POST method, but it's your call.

The PHP page on that web server that processes the form should properly calculate the total cost of the pizza and display a summary of the order. The summary should display these six things: name and address, pizza size, any toppings selected, whether it should be picked up or delivered, and the totoal cost of the order.

As a test, a 14 inch pizza with 2 toppings that is to be delivered should run $10 + $2 + $5 = $17. We won't worry about tax, and we will assume that the user will properly select either pick-up or delivery.

For full credit: The separate php page that processes the order should determine if there is something typed into the two textboxes and the password field (doesn't matter what). If any of these three are empty print an error message with the order summary. Also the user should have the option to select no toppings and you should take this into account. And, I have assumed that if the user doesn't select delivery or pickup that they mean pickup, so you may want to have that radio button selected by default.

What follows are a couple of practice runs. The first is a successful order. There was a password entered, it just did not show up in this image.


Here is the summary printed for the above. I used a HTML list to format the summary, but again, the format is up to you. Note the two toppings are listed.


This next example has an essentially empty form when the user clicks submit.


And the result should look more or less like this. As I mentioned I assume pickup if they don't specify, and you should identify any toppings selected but also account for th possibility that no toppings being selected.


Start early, paste your code into an email if you get stuck.

Step by Step Solution

3.39 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

The HTML and PHP code for the given question ... 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

Document Format ( 2 attachments)

PDF file Icon
635dec4ed8da5_180007.pdf

180 KBs PDF File

Word file Icon
635dec4ed8da5_180007.docx

120 KBs Word File

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

Elementary Statistics

Authors: Robert R. Johnson, Patricia J. Kuby

11th Edition

978-053873350, 9781133169321, 538733500, 1133169325, 978-0538733502

More Books

Students also viewed these Accounting questions

Question

Write out the first three terms in the expansion (x + y) 12 .

Answered: 1 week ago