Bike Shop. Stage 4/5

A form to order

Report a typo

Description

As a good business person, you want your customers to order bikes of their choice. An elementary form with a few fields would do — the name, surname, and phone number would be enough. One crucial requirement is that customers should be able to order only those bikes with all the parts available. Disappointing customers is not your way of business.

To complete this stage, create a simple form with three fields — name, surname, and phone number and add it to the template used to generate bike pages. Each form field should be in a separate paragraph.

Next, check whether all the bike parts are available in the shop: the frame and seat of the specified color, tires (remember, two tires per bike!), and a basket if needed. If you have all the parts — display the form. If any parts are unavailable, show Unfortunately, this bike is currently not available in bold and in the <p> tag instead of the form. For more information, check the screenshots below.

No need to worry about handling post requests at this point; we will take care of them in the next stage.

Objectives

  • Create a form for ordering bicycles. It should contain the order button with submit type and three fields: first name, last name and phone number. Make sure the name attribute is set for each of them (name, surname and phone_number respectively) and all three fields are labeled as follows: your name:, your surname:, your phone number:

  • Check whether all bike parts for the particular bike are available. If so, display the form. If not, output Unfortunately, this bike is currently not available. in bold.

Examples

Example 1: the /bikes/1/ page; the bike is available

Bike Shop site: the /bikes/1/ page with a form; the bike is available

Example 2: the /bikes/1/ page; the bike is not available

Bike Shop site: the /bikes/1/ page; the bike is not available

Write a program
IDE integration
Checking the IDE status
___

Create a free account to access the full topic

Topics in stage