Home >Web Front-end >HTML Tutorial >What is the purpose of creating a form in a web page?

What is the purpose of creating a form in a web page?

青灯夜游
青灯夜游Original
2020-08-31 16:57:174871browse

The purpose of creating a form on a web page: to collect information. For users, forms are an interface for data entry and submission; for websites, forms are a way to obtain user information. The form collects information from the user and then submits this information to the server for processing.

What is the purpose of creating a form in a web page?

# Forms are a set of fields used to collect information about site visitors. The form collects information from the user and then submits this information to the server for processing.

Form is an important external form to implement dynamic web pages. Forms can be used to collect the visitor's information or implement search and other functions.

Processing process of form information: When you click the submit button in the form, the information entered in the form will be submitted to the server, and the relevant applications of the server will process the submitted information. The processing result is either to store the information submitted by the user in the server-side database, or to return the relevant information to the client's browser.

To fully implement the form function, two aspects need to be designed: one is the HTML source code used to describe the form object; the other is the client-side script, or the server-side program used to process the filled-in information.

Form composition tags

##Set the elements of the input formSet the list elementSet the list element Item
Tags Description
Define a form area and carry form-related information
Form mark

<form name="表单名称,用于脚本引用" method="提交方法,定义表单数据从客户端传到服务器的方法,get和post两种,多用post方法" action="处理程序,用于指定处理表单的服务端程序">...</form>

In addition to the above three attributes, there is also the onsubmit attribute, which is used to specify the script function and enctype attribute for processing the form.

Action attribute

The action attribute defines the action that is performed when the form is submitted.

The usual way to submit a form to the server is to use a submit button.

Normally, the form will be submitted to a web page on the web server.

In the above example, a server script is specified to handle the submitted form:

<form action="action_page.php">

If the action attribute is omitted, the action will be set to the current page.

Input tag

(type and name attributes are required Attribute)

type attribute value

##type attribute valuetextSet the single-line text box elementpasswordSet the password elementfileSet file elementshiddenSet hidden elements radioSet the radio button elementcheckboxSet the multiple (multiple) check box elementbuttonSet the normal button elementsubmitSet the submit button elementresetSet the reset button elementimageSet the image button elementMore related For knowledge, please visit: PHP中文网
Description
!

The above is the detailed content of What is the purpose of creating a form in a web page?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn