Felitaur Site
Offerings
|
   
|
[Webscripting Homepage] | [Javascript Homepage] | [Perl/CGI HomePage] | [PHP Homepage]
PHP Basic Form Response
For this programming assignment, you will create one file.
firstform.php and it should be linked clearly on your index.html page.
- requirements for the HTML output of your program
- Remember this is just OUPUT generated by PHP, it is NOT a separate page
- A basic html form page format (may want to use <<< )
- Have a text field that asks for their first name
- A text field that asks for their age
- A set of radio buttons that asks a question (yes,no, maybe as your three answers)
- The method should be "post" and the action should be
"firstform.php" or $_SERVER[SCRIPT_NAME]
- And the page and any output must validate to HTML 5
- Programming Requirements
- As it is slightly safer, 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)
- Only print if they have entered something, if they hit submit without entering anything, print out an error and reshow the form.
Use the
if ($_POST['submitted'])
{
*process form*
*real work is done here*
}
else
{
*show form*
}
for your basic 'control"
- Print back the name in a "Hello $name" format, but, if it is
YOUR first name, have a different greeting. In my case, if the name
matched "Phil" I'd say, "Wow, Phil is such a cool name" ;)
- Take their age, and print (using a loop, probably while()) out
a countdown to their age. (If they are 10, you should see it print 1 2 3 4
5 6 7 8 9 10)
- Use a switch statement (But NOT the 'TRUE' weird version) for the question
- If yes, print out a working link to some page
- If they choose "no" print out a different link
- If they choose "maybe" print out both links
- Use trim() and strlen to partially decontaminate the user input
- Print the date at the bottom of the page in the format
Tuesday, September 9, 2010
This page last updated on:
|
|