Home  >  Article  >  php教程  >  php 多个submit提交表单 处理方法

php 多个submit提交表单 处理方法

WBOY
WBOYOriginal
2016-06-13 12:22:521362browse

test.php

复制代码 代码如下:


$test = $_POST[ 'test '];
echo '12 ';
echo $test;
echo $_POST[ 'submit1 '];
echo $_POST[ 'submit2 '];
if (isset($_POST[ 'submit1 ']) && $_POST[ 'submit1 '] == 'submit1 ')
{
echo 'ok1 ';

}
if (isset($_POST[ 'submit2 ']) && $_POST[ 'submit2 '] == 'submit2 ')
{
// echo " ";
// header( "Location:index.php ");
// break;
echo 'ok2 ';
}
?>



复制代码 代码如下:












为什么 这个测试页面 载入后第一次不传数据?
echo $_POST[ 'submit1 '];echo $_POST[ 'submit2 '];都打印空
之后就好了。这个是什么原因 有没有办法解决?
方法二:





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