7 Introduction To Forms, The FORM INPUT Tag Text Input
7 Introduction To Forms, The FORM INPUT Tag Text Input
7.2 OBJECTIVES
7.9
7.1 INTRODUCTION
Data from site visitors is required for HTML Forms. You may aim to assemble data like
names, emails, billing details, etc. The visitor's inputs will be sent to a server-side programme
through a post request, such as a CGI, ASP, or PHP script. The provided data will be
processed by the back-end application in accordance with the application's own business
logic. Text fields, text area fields, choose lists, radio buttons, checkboxes, and more are just
some of the form components that may be used.
<form action="Script URL" method="GET|POST"> form elements like input, text area etc.
</form>
7.2 OBJECTIVES
When you have finished this unit successfully, you will be able to-
● Learn the importance of HTML Forms in modern web development.
● Explain how HTML FORMS function.
● To learn the basics of creating standards compliant, best practice HTML forms.
● Students will learn how to create a Java server-side application (known as JSP) that can
receive form data from a client and save it to a database.
7.3 HTML FORMS: AN OVERVIEW
The web is evolving from a place where you read a network of sites to one where you can get
things done. Interactions like entering an email address, payment card number, petition
signature, site search, or tweeting are all handled through forms. HTML offers form to
facilitate user interaction with a web server. Data entered into a form is often sent to
server-side software developed in a scripting language for processing.
In a nutshell, there are two components to a working form. First is the HTML mark-up that
creates the form that users see on the page. Information is gathered from the user through the
form's buttons, input fields, checkboxes, and drop-down menus (together referred to as "form
controls"). Text and other components may also be included in a form. The other part of a
form is a server-side programme or script that processes the data submitted by the user and
provides a relevant answer. What makes the shape functional? It needs programming to create
a web application or script; just publishing an HTML page with form components isn't
enough.
How Forms Work?
When designing online forms, it helps to know what goes on behind the scenes. -
1. The process of collecting names and emails for a mailing list is broken down into its
component parts and shown with the help of a sample form. It's a standard step in the
production of many different kinds.
2. The first step is for the user to access a page that has a web form in the browser
window. As can be seen in the figure below, the browser interprets the HTML
containing the form control elements and displays the form controls—two text fields
and a submit button—appropriately.
3. Visitors who are interested in joining this mailing list fill out the form with their
information and click the "Submit" button after they are finished.
4. The data input is gathered by the browser, encoded, and then sent to the server-side
web application.
5. The data is processed by the web app after being accepted (that is, does whatever it is
programmed to do with it). A database entry is created using the given name and
email address.
6. A response is sent back from the web app. What sort of reply you get depends on the
nature and intent of the form? In this case, you may expect to see a webpage with
some kind words when you join up for the mailing list. In response, other programmes
may refresh the HTML structure page with the client's refreshed data, divert the client
to an alternate structure page, or show a mistake message if the user submits an
incorrect form.
7. The browser receives the answer from the server and displays it.
2. POST Method
This encoded data is sent using the POST method of the HTTP protocol. Since arguments are
not included in a POST request's URI, the data being supplied using this method will be
hidden from view.
Since only the server can view the contents of this request, it is the most secure technique for
transmitting sensitive data like a credit card number or other personal information. Since the
POST method does not have a character restriction like the GET method does, it is ideal for
delivering a lot of data, such a long text input. Some clarifications about POST requests:
● No trace of POST requests can be seen in the browser cache.
● The following is true: POST requests cannot be bookmarked.
● No maximum length limitations on data are imposed on POST requests.
✔ Single-line text input controls - Select this option for text boxes that
can only accommodate a single line of text, including search bars and
login names. They are created using HTML <input>tag.
<input type="text">defines a one-line input field for text input:
Example:
✔ Password input controls - Like the last model, this is a solitary line
</form>
</body>
</html>
</body>
</html>