Slide 1 CMPS 211 Internet Programming Spring 2008 Forms Chapter 17 4/22/08
Slide 2 CMPS 211 Internet Programming Spring 2008 Forms Forms have three parts: The tag The actual FORM elements where the visitor enters information Submit button (or active image) that sends the collected information to the server.
Slide 3 CMPS 211 Internet Programming Spring 2008
Slide 4 CMPS 211 Internet Programming Spring 2008 Processing forms Forms gather information from a visitor A script processes the information PHP is a popular script language –Easy to learn –Designed for processing info obtained on the web –Can be written right in the file with the (X)HTML –Hundreds of functions available
Slide 5 CMPS 211 Internet Programming Spring 2008 Alternative to processing Send data via using: form.php is a script that sends the data to your Figure 17.6 is such a script and is available on the text website
Slide 6 CMPS 211 Internet Programming Spring 2008 Grouping form elements Personal Information Suggestions
Slide 7 CMPS 211 Internet Programming Spring 2008 Form elements Text boxes Password boxes Radio buttons Menus Check boxes Large text boxes Hidden fields Submit button Image to submit Disabling elements Keeping elements from being changed
Slide 8 CMPS 211 Internet Programming Spring 2008 Text Boxes Personal information Name: Address: Enter password: Style rule: p.legend {backgrouond:#DED983; color:black; border:2px outset #DED983; padding:.2em.3em; font-size: 1.2em; position:relative; margin: 1em 0 -1em 1em; width: 10em;}
Slide 9 CMPS 211 Internet Programming Spring 2008 Radio Buttons Size: King Queen Twin Single Style Rules: #choices label{position: absolute; padding-top:.2em; left: 20px} #size{font-size: 90%} Input {margin-left: 9em;} Input+input{margin-left: 1em;} Br+input{margin-left:9em;}
Slide 10 CMPS 211 Internet Programming Spring 2008 Menus Type of wood: Mahogany Maplewood Pine Cherry Can also group options using the tag
Slide 11 CMPS 211 Internet Programming Spring 2008 Other fields Checkboxes – like radio buttons but allow multiple selections Larger text area – upto 32,700 characters, need to provide rows & columns Upload files – provide URL of file to upload; need script to process Hidden Fields Submit button – special button to signify input complete, perform action Reset button – Erase all input and start over