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 Arrays Program Assignment
  • arrays.php (HTML requirements)
    1. arrays.php must generate a basic, validating HTML 5 form page that has the fields shown. example form for arrays assignment
    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. (hint: something like $item = $_POST['item']; )
    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 for example, but this pull down menu does NOT have to sync up with the first pulldown menu/checkboxes)
    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 can be post or get and the action should be the $_SERVER[SCRIPT_NAME] variable.
  • PHP requirements
    1. Use the $formstuff = $_POST['item'] type format to grab your responses from the form as an array (note: as a reminder, namefromform is whatever you used in the name="  " attributes in the form)
    2. Use an $errors array to store errors and either show form again with errors listed, or if no errors, show output. Only need to check to see if fields are empty.
    3. Using an associative array of associative or 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)
    4. 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.
    5. ***********************************************************
      this section is independent of the previous part, as far as your program is concerned, with the exception of detecting errors (ie nothing chosen)
      ***********************************************************
      Create another pull down menu with a list of choices. (Note, they don't have to match with the first pull down menu). On the PHP side, you will create an array, that matches in order that select list. Based on what they choose from the select pull down menu, print out the appropriate response from the array you created.
    6. Based on the radio buttons (again using the shoe example) retrieve information that you have stored in yet a third array. So, if they choose "mens" have your php script print out the range of sizes available for mens shoes.
    7. Print the date at the bottom of the page in the format Tuesday, September 12, 2006

This page last updated on: