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 |
Define a form area and carry form-related information | |
Set the elements of the input form | |
<form name="表单名称,用于脚本引用" method="提交方法,定义表单数据从客户端传到服务器的方法,get和post两种,多用post方法" action="处理程序,用于指定处理表单的服务端程序">...</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">
Input tag
(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!