gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

php 多个submit提交表单的实例代码

来源:http://erdangjiade.com/topic/1605.html 你好,世界。 2017-09-25 22:42浏览(11)

当输入用户名和密码为空的时候,需要判断。这时候就用到了校验用户名和密码,这个需要在jsp的前端页面写;有两种方法,一种是用submit提交。一种是用button提交。

本篇文章主要向大家讲述在php中一个多个submit提交表单如何处理(区分不同的表单提交)

test.php

<?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 " <meta http-equiv=refresh content= '0; url=http://localhost:8000/php/index.php '> "; 
// header( "Location:index.php "); 
// break; 
echo 'ok2 '; 
} 
?>

代码如下:

<html> 
<head> </head> 
<body> 
<form action= 'xajaxtest.php ' method= 'POST '> 
<input type= 'hidden ' name= 'test ' value= 'test1 '> 
<input name= 'submit1 ' type= 'submit ' value= 'submit1 ' title= 'submit1 '> 
<input name= 'submit2 ' type= 'submit ' value= 'submit2 ' title= 'submit2 '> 
</form> 
</body> 
</html>

以上就是php 多个submit提交表单的实例代码的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2