表单和表单提交到php页面怎么不成功?

<script type="text/javascript">
$(function(){
$("#btnSubmit").click(function(){
$("form[name='baomi6666']").submit();
$("form[name='baomi3333']").submit();
})
})
</script>

<form name="baomi6666" method="post" action="/e/member/register/aaa.php" style="float:left;margin-left:20px;">
<input name="baomi222" value="baomi" type="hidden">
<div class="input-control text span4 as-block">
<input required="required" placeholder="在这里输入手机号免费报名" name="phone" type="phone">
</div>
</form>
<form name="baomi3333" method="post" action="/e/member/register/aaa.php" style="float:right;font-size:12px;">
<button id="btnSubmit" class="bg-color-red" style="color:#fff;font-size:16px;min-hight:38px;margin-right:28px;">提交报名</button>
</form>

-------------------------------------《下面是aaa.php>>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<?php echo $_POST["baomi222"]; ?><br>

</body>
</html>

没有你这种写法啊.. 你把aa.php改成纯php脚本啊
不要写html代码啊,可读性太差了
直接将aa写成这样

<?php

var_dump($_POST);//看你传过来的东西

?>
温馨提示:内容为网友见解,仅供参考
第1个回答  2015-09-24
你这个写法可以称得上是全世界最奇葩的写法!追问

怎么说呢?这个是草稿,完成后,再归并CSS,JS

追答

一个页面两个表单倒也不是不可(通常只有一个, 但根据实际情况也可以有多个),但两个表单都是提交到同一个页面, 而且还是同时提交, 这就是奇葩!
况且, 你第二个表单只是一个按钮而已, 何必放在单独的一个并没有实际意义的表单中做什么呢?而且, 服务器端同时只能处理来自同一个表单内的数据!
你2表单同时提交到同一个页面,等于是第二个表单提交了, 第一个表单的值自然无法接受到!
这还不奇葩吗?

本回答被提问者采纳
相似回答