Fordham, the Jesuit University of New York

CISC 3300 L01

Internet & Web Programming

Spring, 2015

Dr. Robert K. Moniot

back Back to course home page

Web Project 8: a PHP form handler

Assigned: Monday, March 23
Due date: Monday, March 30
Points: 10

The aim of this project is to get practice using PHP to process a form.


This project will implement a simple initial shopping interface. The visitor will be invited to select a product to view, and in response will be shown a page about that product. Spend a little time thinking up an enterprise that this would serve, and keep everything consistent with that theme.

Create a single PHP web page named project8.php that has two modes:

  1. When visited without supplying form data, it presents the visitor with a form, suitably laid out, allowing the visitor to select one of a small number (three or four) of products. This can be done in a way you prefer, e.g. with a menu or radio buttons. Form submission returns to the same URL.
  2. When the form is submitted, your PHP script responds with a page providing information about the selected product. This does not need to be elaborate, but each different product's page needs to be unique.

The form must use the POST method of submission, but the processor may respond also to GET submissions (useful for debugging). Remember that $_REQUEST holds the data from either method of submission.

Be sure to process the form data in a way that is not vulnerable to errors or exploits from bogus requests. (An example would be a request for a product that does not exist.) The response to bogus data can simply be to re-present the form. (Because honest submissions from your form will always have valid data, you don't need to dignify dishonest requests with any special treatment.)

Hint: a simple and scalable way to implement the response is to create separate files with the HTML body content for each product, and use the PHP include function to insert the file for the chosen product into the body of the response.

Note: Your project page must pass the W3C validator with no more than the unavoidable warning about the experimental HTML5 conformance checker.