Web2 Prelim Checkbox, Select and Array
Web2 Prelim Checkbox, Select and Array
1. One frequent application of an array is when you need to capture the values of checkboxes from an
HTML form. Checkboxes are used when multiple values can be selected. For instance, if you asked
someone to list the types of pets they own. It is likely that an individual will own no pets, one pet,
two pets, etc. If you wanted to get all the pets an individual owns, you could use a set of checkboxes.
Create a PHP program that will display the pets selected by the user.
2. Another application of an array is when you need to capture the values of drop-down list (<select>
tag) from an HTML form. Drop-down lists are used when multiple values can be selected. For
instance, if you asked someone to choose the types of pets they own. It is likely that an individual
will own no pets, one pet, two pets, etc.
Create a PHP program that will display the pets selected by the user.