Challenge 01: Are You Really a (Web) Programmer?

This exercise is worth ≥ 0% of the marks for CS25320, but upon completion of this exercise you will become a TRUE Novice Web Programmer (and part of the code may aid you in your assignment)! But failure to do so will result in facing a even harder exercise. This is an individual exercise and needs to be done within 1 hour. Now go! Young programmers!

Here Comes the Exercise

Pass a user input variable cross 3 web pages using differnet forms and sessions. This means you need to make 3 working web pages and save your work under public_html directory (you may create a subdirectory for this ecercise). CSS is not required but recommended. You may also:

Exercise Breakdown

Make sure to complete everything stated below. Anything this web page did not state are optional. Vaughan reserves the right to modify or withdraw this site at any time without liability.

Web Page 1

This page allows user to type in a string and submit it for further use. You need:

  1. A text box for user input.
  2. A button to submit text to next web page.

The text box allow user to type in any characters but can not leave empty (or null, or "") before submit. Press the submit button to web page 2.

Web Page 2

Take the input text from web page 1. Create a variable with its name based on the input text type:

  1. A number: Create an integer and call it alchemist.
  2. TRUE or FALSE: Create a boolean and call it rogue.
  3. Else (mix characters): Create a string and call it barbarian.

Store the input text in the created variable with appropriate variable type. Print the variable name and value. Store the key and value in a PHP session. Pass it to web page 3.

Web Page 3

Print the key and value from web page 2. Change the value based on variable type:

  1. Integer: add 42 to the number.
  2. Boolean: switch the boolean (true becomes false, false becomes true).
  3. String: cut thee text in half, and save the second half (e.g. abcdefgh => efgh).

Store the modified session variable in a cookie with same variable name. End the session and print the cookie.

Additional Requirement

A good programming style with rich comments can make code debug and maintenance much easier. Make sure your web page:
  1. Use appropriate variable names.
  2. In each page,provide links to the other 2 pages (for easy access).
  3. Pass W3C validation.

Show the working web pages to Vaughan when you have finished.