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.
(hint: something like $item = $_POST['item']; )
- 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 the $_SERVER[SCRIPT_NAME] variable,
which is the best way to do it.
- PHP requirements
- Use the $item = $_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)
- 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)
- 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.
-
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.
- 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:
|
|