HTML Code for Online Forms
HTML Code for Online Forms
The HTML code for your online forms will contain form elements that will enable the end user to enter the required information online. These form elements can include text boxes such as a text area or text fields. Alternatively the information entered by the end user can be controlled by including radio-buttons, drop-down menus and checkboxes. All these form elements can easily be included in your online forms via proper HTML code.
To create a form in an HTML document the
Radio Buttons
Radio buttons are used when the end user is required to select one choice from a specified list.
To insert a list with radio buttons used the following code:
Checkboxes
Check boxes are similar to radio buttons; however with check boxes can select more than one item from the specified list.
Submitting your Form
The information that is collected in an online form is sent to an identified server when the user clicks on the Submit button. This process is defined by the HTML form’s “action” attributes which defines the name of the server where the form data is sent. We also need to tell the browser how to send the form data to the server and this process is defined via the “method” attributed. The “method” attribute specifies how the data is send by using either the “get” or the “post” commands.
The “get” method is only used when the data collected does not exceed 255 characters, in addition this method is not secure and is thus not recommended when confidential data is being collected. In all other cases the “post” method is used.
The below code illustrates how to specify the form’s action and method attributes by specifying an email address. In the below example the data submitted in a form will be received by email.
This post is part of the series: HTML Web Page Coding
This series will guide users through a number of articles that explain basic HTML web page coding starting from the basic elements of an HTML document to advanced HTML coding that includes how to insert a table and build forms in a web page with HTML code.