Home >Web Front-end >HTML Tutorial >What is the purpose of creating a form in a web page?
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.
# 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
Tags | Description |
ff9c23ada1bcecdd1a0fb5d5a0f18437 | Define a form area and carry form-related information |
Set the elements of the input form | |
Set the list element | |
Set the list element Item | |
Set the form text area elements, such as remarks |
<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 tagd5fd7aea971a85678ba271703566ebfd
d27ccba71ae9075bc86043a15c339879(type and name attributes are required Attribute)type attribute valueDescription | text |
password | |
file | |
hidden | |
radio | |
checkbox | |
button | |
submit | |
reset | |
image | |
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!