Practice Exercise: Form Techniques
Instructions:
Create HTML forms and use PHP to process data collected and output results for
each technique. Reference the "HTML/PHP Program Example" named
"Form Techniques".
1. Prepare a form for data collection with labeled text boxes. The form start
tag is to have a method attribute specifying the "post" method and an action
attribute pointing to a php script to process collected data. After the start
include unpaired input components(tags) for two data items each having an
attribute for the text(box) type and for a name specifying a parameter to
pass to a script for processing. Include another input component with type
attribute for a "submit" button and a value attribute for the string "enter".
2. Text area:
Prepare a form that includes a textarea with multiple rows and columns. Code
PHP statements to verify data was submitted, then display the box contents or
an exception message.
3. Radio buttons:
Code an HTML form that displays a set of radio buttons for mutually exclusive
choices. Use PHP to display the value associated with the button clicked (or
that no button was clicked).
4. DropDown List:
Prepare a form with a dropDown list of choices. Prepare PHP to determine and
output results from the option chosen. Consider having a default option.
5. CheckBox:
Construct a form with check boxes for multiple choices. Use PHP to test
whether boxes were checked then loop through statements to display each
choice; otherwise output a message to show no selection was made.
6. Menu:
Write HTML statements with address tags for linking to forms with:
a) textbox area, b) checkBoxes, c) radio buttons, and d) a dropDown list.