logo © 1996 Phil Waclawski
Felitaur Site
Offerings
About Me
Crafts
Services
ftp files
Help Files
What's New?
Home Page
Other Links
Anatomy &
Physiology
Arthropods
Biology
Computers
Ferrets
Fun Links
Internet
Linux
S.C.A.
Win 95/NT
Comments or
Suggestions
webmaster@ felitaur.com
   
[Webscripting Homepage] | [Javascript Homepage] | [Perl/CGI HomePage] | [PHP Homepage]
PHP Program Assignment 2
  • prog2.php (HTML requirements)
    1. prog2.php must generate a basic, validating xhtml form page.
    2. ALL variables from the form must use the array naming scheme (ie name="item['firstname']) so that in the php portion, you have one array variable that contains ALL the output from the form.
    3. Have a text field that asks for their name
    4. A pull down menu that lists 8 different items to buy
      • Three checkboxes so that the customer can choose to see info on price , description and estimated weeks until shipped. (and of course choose all three if they want)
    5. A pull down menu that lists options for those items (if a list of shoes, then colors say)
    6. A set of radio buttons that sets a limited number of choices (for shoes, say, mens, womens , boys or girls)
    7. If they forget to fill items out, use an array to store and print out their errors.
    8. The method should be "post" and the action should be "prog2.php (or the PHP_SELF variable, which is better)"
  • PHP requirements
    1. Use the $_POST['namefromform'] type format to grab your responses from the form (note: as a reminder, namefromform is whatever you used in the name="  " attributes in the form)
    2. Using an associative array of indexed arrays, relate the item name of the 8 items for sale in the first pull down menu to an array containing
      • price
      • detailed description (one sentence or so)
      • Number of weeks to be shipped
      • (So, this will be an associative array of arrays, aka multidimensional)
    3. So, when they choose an item in the pull down menu and submit the form, it should return information from this "hash of arrays" based on what check boxes they check.
    4. Based on what property they choose from the second pull down menu, say "colors of shoes", store information in a standard array for each choice. For example, for blue shoes you may want to have "not available in suede". For green shoes have it be "takes 3 extra weeks if ordered in March". But use the standard 0..1..2 indexing for the array. Spit back the cute comment along with the choice they made.

      So, if they choose "blue" then spit back to them "You ordered blue shoes. Not available in suede".

    5. Based on the radio buttons (again using the shoe example) store information in yet a third array. So, if they choose "mens" have your php script print out the range of sizes available for mens shoes.
    6. Print the date at the bottom of the page in the format Tuesday, September 12, 2006

This page last updated on: