Felitaur Site
Offerings
|
   
|
[Webscripting Homepage] | [Javascript Homepage] | [Perl/CGI HomePage] | [PHP Homepage]
PHP Program Assignment 2
- prog2.php (HTML requirements)
- prog2.php must generate a basic, validating xhtml form page.
- 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.
- Have a text field that asks for their name
- 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)
- A pull down menu that lists options for those items
(if a list of shoes, then colors say)
- A set of radio buttons that sets a limited number of choices
(for shoes, say, mens, womens , boys or girls)
- If they forget to fill items out, use an array to store and print out
their errors.
- The method should be "post" and the action should be
"prog2.php (or the PHP_SELF variable, which is better)"
- PHP requirements
- 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)
- 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)
- 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.
- 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".
- 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.
- Print
the date
at the bottom of the page in the format Tuesday, September 12, 2006
This page last updated on:
|
|