The form is a document that contains a couple of blank fields that the user has to fill the data or the user can select the data. The user’s data is stored in the database with the respective user’s data and can be retrieved anytime and anywhere needed….
HTML forms are used to send the user information to the server and returns the result back to the browser. For example, if you want to get the details of visitors to your website, and send them good thoughts, you can collect the user information by means of form processing. Then, the information can be validated either at the client-side or on the server-side. The final result is sent to the client through the respective web browser. To create a HTML form, form tag should be used.
When you login into a website or into your mail box, you are interacting with a form. Forms are used to get input from the user and submit it to the web server for processing. A form is an HTML tag that contains graphical user interface items such as input box, check boxes radio buttons etc. The form is defined using the tags and GUI items are defined using form elements such as input.
Forms come in handy when developing flexible and dynamic applications that accept user input. Forms can be used to edit already existing data from the database.
Attributes of Form Tag:
- name or id – It specifies the name of the form and is used to identify individual forms.
- action – It specifies the location to which the form data has to be sent when the form is submitted.
- method – It specifies the HTTP method that is to be used when the form is submitted. The possible values are get and post.
- If get method is used, the form data are visible to the users in the url. Default HTTP method is get.
- encType – It specifies the encryption type for the form data when the form is submitted.
- novalidate – It implies the server not to verify the form data when the form is submitted.
Controls used in forms: Form processing contains a set of controls through which the client and server can communicate and share information. The controls used in forms are:
- Textbox: – Textbox allows the user to provide single-line input, which can be used for getting values such as names, search menu and etc.
- Textarea: – Textarea allows the user to provide multi-line input, which can be used for getting values such as an address, message etc.
- DropDown: – Dropdown or combobox allows the user to provide select a value from a list of values.
- Radio Buttons: – Radio buttons allow the user to select only one option from the given set of options.
- CheckBox: – Checkbox allows the user to select multiple options from the set of given options.
- Buttons: – Buttons are the clickable controls that can be used to submit the form.
Creating a simple HTML Form:
When the PHP and HTML are coded in a single file, the file should be saved as PHP. In the form, the value for the action parameter should be a file name. Having the ability to create a form of any depth of detail and/or user input gives you the ability to host your own employment application forms on your website, or perhaps an extensive registration form for an event of some type, or for product details.