INFO 10112: Web Scripting with PHP
Assignment Two — 30 Marks


In this assignment, you will add to your web application from assignment one (that uses a template on a theme of your choice):

  1. MySQL portion: Create a table in your instructor's "assignment" database. In this data table:       [5 marks]
    1. create a field in this table for each of your HTML form fields from all of your forms used in this assignment. Use the same field names in your MySQL data table that you used in your HTML forms in this assignment.
    2. From your instructor, obtain the:
      • host computer/domain name
      • database user ID
      • database password
      • database name
  2. PHP Portion: You will complete this portion of the assignment using PHP sessions which will span several PHP pages. In this method, each of the features below must be in a separate file. For this to work, you must use the newer $_SESSION feature covered in the course text.

    You add the value entered in each field from your HTML forms into the $_SESSION variable in each of the pages/files below.

    In this PHP portion of the assignment you will:
    1. Edit your customer registration HTML form from assignment 1 to make use of PHP sessions. When all validation has completed successfully, you should make use of the PHP header() function to move to the next HTML form to obtain more information about the customer's address. Change the "submit" button into a "next" button.       [1 mark]

      For the additional features:       [18 marks]
    2. Add a new HTML form with fields for the customer's address info: street, city, province, postal code. The submit button text should read "next" button. After passing validation for all fields, you should again make use of the header() function to move to the next page , a new "confirmation page".      [5 marks]

    3. In the confirmation page, display all of the data collected in both HTML forms: the person's name, email and password along with all of the person's address info. This should display with a "next" button pointing to your "Thank you" file from assignment 1.       [4 marks]
    4. Edit your thank you page — have the all of the info appear, but in between form tags, add a the submit button will now say 'add'. When the visitor clicks on this, you will add the data collected to the customer MySQL database table you created in the first question in this assignment.       [5 marks]
    5. Use this portion of your web application to add 3 people into the database.       [3 marks]
    6. Some Important Notes: Use sticky forms so that fields will retain their data until they pass validation. All form fields must be completed (no blank fields allowed).

  3. Create a PHP script file which will:       [5 marks]
    1. query the data table you created in question 1
    2. create a heading table row using the name of each field
    3. display the entries in an HTML table, with one customer entry per table row

  4. Upload all of these files into your web account in the top folder level. Send your instructor an email message when the assignment is ready for grading. In this email message, include a link pointing to your main file and tell the instructor the name of your data table in the assignment database.       [2 marks]


[Back to previous page]