Problem Set 9
Fall 2008
Due: Beginning of class, Monday, 17 November 2008.
Reference: Gosselin, chapter 10 and Just Enough Web Programming wiht XHTML,
PHP, and MySQL, chapter 6.
Create a web page with the following features. Note that you must
implement these features by "hand", i.e., you may not use Dreamweaver,
Adobe ImageReady, Macromedia Fireworks, or any other tool. Also, you may not
use the "this" tag in any of your solutions.
- Your page must have a header/footer that each contain an image. You do
not have to use SSI.
- The page must have a form that lets you vote for college president,
college vice president, and for two college senators. There are three separate elections with different
people running in each.
- For the presidental election, you must have a drop-down box with three
candidates, one of which can be voted for.
- For the vice-presidental election, you must have a radio button with
three candidates.
- For the senator election provide four checkboxes.
- You must have a button that says "vote" that will submit the
chosen candidates to a php script.
- Before the votes are submitted to the php script, use javascript to
make sure that no more than two senators were checked. If more than
two were checked, abort the submission and put up an alert box with an
error message. If 0 or 1 checkbox was selected, go ahead and submit.
- The php script must receive the votes and store them in a file. I
recommend storing each candidate on a separate line of the file. On a candidate's
line, store the position they're running for and the updated number of votes
that they have received. Note that you'll have to first read in the current file
before you can update the number of votes that the candidates have received.
- Your page must also have a button labeled "results". When this button is
clicked, you must call a php script (this can be a different script that before)
that will return a web page that lists each
position and, for each position, every candidate for that position and, for
every candidate, the number of votes she/he has received.
- This script must open the file stored on the server, read in each candidate
and their position and the number of votes that they have received. It will
then create the correct web page as described above.
- Your script will read in every line in the file. It will then use string
operators to dissect the lines and find the different fields (i.e., name,
position, and number of votes).
- As you determine the candidates, their position, and the number of votes,
you can echo or print this information to the web browser.
|
|
|
 |