When receiving the submitted form, PHP sets (Web hosts) the

When receiving the submitted form, PHP sets the POST array with the data that the form sends. As with any array, you can directly access any of the indexes by name. In this instance, you can clearly see that the Name index contains the value test. This trick works for all forms, even the most complicated ones. Let s move on to see how you can use more HTML elements during form input to interact with the user. Driving the User Input The form in this example allows you to lead the user to choose values from a set of values you provide. Defining a value set is done through the use of specific HTML elements, such as list boxes, radio buttons, and checkboxes. Two kinds of predefined user input are in HTML forms. The first kind allows you to choose one item from the available options; the second allows the user to choose multiple items. Drop-down list boxes and radio buttons allow for one selection only. Checkboxes and multiline list boxes provide for multiple choices. Try It Out Limiting the Input Choice Let s start with the simple type of input. Follow these steps to create a single selection list: 1. Create a text file named form2.html and open it in your favorite text editor. 2. Enter the following code:

Name
Greetings

141 Form Elements: Letting the User Work with Data
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply