$field_name:"; break; case "radio"; $next_field = "$field_name:"; break; case "checkbox"; $next_field = "$field_name:"; break; case "hidden"; $next_field = "$field_name:"; break; case "textarea"; $next_field = "$field_name:"; break; case "select"; $next_field = "$field_name:"; break; default; break; } return $next_field; } if (isset($_POST[posted])) { //capture the values posted $field_name01 = $_POST[field_name01]; $field_name02 = $_POST[field_name02]; $field_name03 = $_POST[field_name03]; $field_type01 = $_POST[field_type01]; $field_type02 = $_POST[field_type02]; $field_type03 = $_POST[field_type03]; //check to see if we need to display the select options form if ($field_type01 == "select" or $field_type02 == "select" or $field_type03 == "select") { //display the Options form ?>
Option Text Option Value
 
"; //construct and display the form made by the user if ($field_name01 != "" and $field_type01 != "") { $my_form .= createTags($field_name01,$field_type01); } if ($field_name02 != "" and $field_type02 != "") { $my_form .= createTags($field_name02,$field_type02); } if ($field_name03 != "" and $field_type03 != "") { $my_form .= createTags($field_name03,$field_type03); } //complete the table for fields $my_form .= "
"; echo "$my_form"; } } else if (isset($_POST[posted01])) { //capture the values posted $field_name01 = $_POST[field_name01]; $field_name02 = $_POST[field_name02]; $field_name03 = $_POST[field_name03]; $field_type01 = $_POST[field_type01]; $field_type02 = $_POST[field_type02]; $field_type03 = $_POST[field_type03]; $option_text01 = $_POST[option_text01]; $option_text02 = $_POST[option_text02]; $option_text03 = $_POST[option_text03]; $option_value01 = $_POST[option_value01]; $option_value02 = $_POST[option_value02]; $option_value03 = $_POST[option_value03]; //begin the table of fields $my_form = "
"; //construct and display the form made by the user if ($field_name01 != "" and $field_type01 != "") { $my_form .= createTags($field_name01,$field_type01); } if ($field_name02 != "" and $field_type02 != "") { $my_form .= createTags($field_name02,$field_type02); } if ($field_name03 != "" and $field_type03 != "") { $my_form .= createTags($field_name03,$field_type03); } //complete the table for fields $my_form .= "
"; echo "$my_form"; } else { ?>
Welcome to Beginning PHP5 Chapter 06 Exercise 01

Please fill out the following field names and types to create your own HTML form.

Field Name Field Type