University of Washington, CSE 190 M, Spring 2007
Lab 8: PHP and HTML Forms (Thursday, May 17th, 2007)

This lab's purpose is to give you some practice writing a PHP script that processes an HTML form. The form will ask the user to type the current time, which will be submitted to a PHP script running on the dante server. The initial page should be stored in time.html and should look roughly like this:


expected output

The user chooses his/her lab section, types a time in HH:MM format, and submits the form to time_server.php using a POST request. This PHP script examines the time submitted and calculates how much time is remaining until the end of lab. It should look roughly like this:


expected output

We would like you to develop this lab in the following steps. Complete as much as you can in the time provided.

  1. Write the HTML page. Have it initially submit its data to http://faculty.washington.edu/stepp/params.php so that you can check that it's running correctly.
  2. Write a "Hello, world" simple PHP script, place it on the server, and verify that you're able to see its output in the web browser.
  3. Modify your HTML page to submit to your PHP script, and modify the script to read and print the query parameters.
  4. Write the actual PHP code to compute the proper time remaining and display it on the screen. Consider processing one section at a time (do yours first, then the other).
  5. Make your script correctly handle the case where the time submitted is after the end of lab, where the script's output should look something like this:


    expected output

  6. Add some basic validation code so that the script will print an error message if the user doesn't submit a valid time in HH:MM format.
  7. Add any CSS styling you like to the page. For example, since the input text box is the central element on the page, make it use large bold sans-serif text. You can also add other form elements to the page, such as the submitter's name.

When you're satisfied with your page, you may optionally wish to turn it in so that we can see it, or upload it to your UW web space. You may need to ZIP your files for them to submit successfully.

Valid XHTML 1.0 Strict Valid CSS!