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 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
    1. Remember this is just OUPUT generated by PHP, it is NOT a separate page
    2. A basic html form page format (may want to use <<< )
    3. Have a text field that asks for their first name
    4. A text field that asks for their age
    5. A set of radio buttons that asks a question (yes,no, maybe as your three answers)
    6. The method should be "post" and the action should be "firstform.php" or $_SERVER[SCRIPT_NAME]
    7. And the page and any output must validate to HTML 5
  • Programming Requirements
    1. 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)
    2. 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"
    3. 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" ;)
    4. 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)
    5. Use a switch statement (But NOT the 'TRUE' weird version) for the question
      1. If yes, print out a working link to some page
      2. If they choose "no" print out a different link
      3. If they choose "maybe" print out both links
    6. 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: