Home  >  Article  >  Backend Development  >  What are PHP forms and form creation

What are PHP forms and form creation

伊谢尔伦
伊谢尔伦Original
2017-04-16 09:05:033203browse

Introduce what a form is

The function of a WEB form is to provide an interactive platform between viewers and the website. WEB forms are mainly used to send data to the server in web pages. For example, forms are required when submitting registration information. When the user fills in the information, the submit operation is performed, that is, the content of the form is transferred from the client's browser to the server. After being processed by the PHP program on the server, the information required by the user is transferred back to the client's browser. superior. By obtaining various information submitted by users, PHP and WEB forms can interact.

Since we mentioned Web development, we have to mention HTML. As the standard language for Web user front-end interface design, HTML is something that developers must understand and apply skillfully, especially the form part of HTML. Particularly important.

Form and HTML markup language

HTML is a world-wide hypertext markup language. Images, links, music and programs can be realized through HTML and many other elements. Nowadays, it is a basic skill necessary for programmers.

Form is the most commonly used component in WEB field applications. It consists of submitbutton and other related components. Forms are used in many fields to implement user registration, login, online shopping, banking and other functions.

Create a form

Use the ff9c23ada1bcecdd1a0fb5d5a0f18437 tag and insert relevant form information into it to create a form. The structure of the form is as follows:

// 插入一些表单元素

ff9c23ada1bcecdd1a0fb5d5a0f18437 TagAttributes are as follows:

##ff9c23ada1bcecdd1a0fb5d5a0f18437Tag attributeDescriptionnameThe name of the formmethodSet the form submission method, GET or POST method actionPoint to the URL of the page that handles the form (relative path Or absolute path) enctypeSet the encoding method of the form contenttargetSet return The way information is displayed, the attribute value of target will be explained below.
#The attribute value of target is as follows:

Attribute value Description_blankDisplay the returned information in a new window _parentThe return information will be displayed in the parent window _selfThe return information will be displayed Display in the current window_topDisplay the returned information in the top-level window

说明:GET()方法是将表单内容附加在URL地址后面发送;POST()方法是将表单中的信息作为一个数据块发送到服务器上的处理程序中,在浏览器的地址栏不显示提交的信息。method属性默认方法为GET()。

举个例子:创建一个表单,再以POST()方法提交到数据处理页面check.php,代码显示如下:


             // 插入一些表单元素

说明:以上的代码中ff9c23ada1bcecdd1a0fb5d5a0f18437标记的属性是最基本的使用方法。需要注意的是,在使用 form表单时,必须指定其行为属性action,它指定表单在提交时将内容发往合出进行处理。

The above is the detailed content of What are PHP forms and form creation. 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