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:174779browse

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

##d5fd7aea971a85678ba271703566ebfdSet the elements of the input form221f08282418e2996498697df914ce4eSet the list element5a07473c87748fb1bf73f23d45547ab8Set the list element Item4750256ae76b6b9d804861d8f69e79d3Set the form text area elements, such as remarks
Tags Description
ff9c23ada1bcecdd1a0fb5d5a0f18437 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 tagd5fd7aea971a85678ba271703566ebfd

d27ccba71ae9075bc86043a15c339879(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