Home  >  Article  >  Backend Development  >  Instructions for using POST and GET to pass parameters simultaneously in the form form in PHP_PHP Tutorial

Instructions for using POST and GET to pass parameters simultaneously in the form form in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:48:571562browse

We have a method attribute in the form, which allows the form to be post and get. In PHP, we should use the corresponding get and post to receive it. Let me introduce the method parameter description below

1. I have used it before. When submitting a form post, the action URL passes the get parameter, which can be obtained by the server:

The code is as follows
 代码如下 复制代码

print_r($_GET);
print_r($_POST);
?>
 


姓名:

年龄:


Copy code

 代码如下 复制代码

/**
*测试get和post提交
*@link(http://www.bKjia.c0m)
*/
print_r($_GET);
print_r($_POST);
?>
 


姓名:

年龄:


print_r($_GET);
print_r($_POST);
?>


Name:

Age:


2. But if your form submission type is get, the parameters passed in the url cannot be obtained:

The code is as follows Copy code
/**
*Test get and post submission
*@link(http://www.bKjia.c0m)
​*/
print_r($_GET);
print_r($_POST);
?>


Name:

Age:


http://www.bkjia.com/PHPjc/632751.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632751.htmlTechArticleIn the form we have a method attribute, which allows the form to be post and get, which should be done in php Use the corresponding get and post to receive it. Let me introduce the method parameter description 1....
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