Home>Article>Backend Development> How to get form data in php

How to get form data in php

(*-*)浩
(*-*)浩 Original
2019-09-27 14:13:41 4963browse

It is often necessary to fill in the user name and password on the web page. After clicking the confirmation button, the user name and password are sent to the server after front-end processing. So how does the server obtain the data submitted by these users?is through the super global variable

How to get form data in php

_POST and _GET

$_GET [](Recommended learning:PHP programming from entry to proficiency)

Description: Get the data submitted by form method = “get”

Example: $username = $_GET[“username”];

$_POST[]

Description: Get the data submitted by form method = “post”

Example :$username = $_POST[“username”];

Let’s take _POST as an example first.

I wrote the following code in the index.html of my site.

means to create a form. The method used to submit this form is the post method, and new.php will process this form. This form has two input boxes, their names are name and age, and a confirmation button, its name is submit, and the text above the confirmation button is submit.

name:

age:

$value) { echo $key . ' => ' . $value . '
'; } ?>

Take _GET as an example again.

name:

age:

rrree

The above is the detailed content of How to get form data in php. 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