Bootstrap模式中的表单不将PHP值发布到另一个页面(Form in Bootstrap modal not posting PHP values to another page)
我在引导模式窗口中使用表单将数据发布到另一个页面。 但是,当我尝试在另一页上打印帖子值时,我得到的是一个空数组。
这是我的模态代码:
<div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> X</button> <h3 id="myModalLabel"> Enter your Credentials</h3> </div> <div class="modal-body"> <form id="modal-form" class="form-horizontal" accept-charset="UTF-8" method="POST" action="login.php" data-remote="true"> <div class="control-group"> <label class="control-label" for="inputEmail">Email</label> <div class="controls"> <input type="email" id="email" placeholder="Email"> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword">Password</label> <div class="controls"> <input type="password" id="passwd" placeholder="Password"> </div> </div> <div class="control-group"> <div class="controls"> <label class="checkbox"> <input type="checkbox"> Remember me </label> <input type="submit" class="btn btn-primary" value="Submit"/> <a href="register" class="btn btn-primary">Sign up</a> </div> </div> </form> </div> </div>这是我在login.php中给出的命令:
echo "Email is:"; echo $_POST["email"]; echo "Password is:"; echo $_POST["passwd"];但是我得到的只是一个空数组。
有什么特别的方式我应该这样做吗?
I am using a form in a bootstrap modal window to post data to another page. However when i try to print the post values on the other page all I am getting is an empty array.
Here's my modal code:
<div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> X</button> <h3 id="myModalLabel"> Enter your Credentials</h3> </div> <div class="modal-body"> <form id="modal-form" class="form-horizontal" accept-charset="UTF-8" method="POST" action="login.php" data-remote="true"> <div class="control-group"> <label class="control-label" for="inputEmail">Email</label> <div class="controls"> <input type="email" id="email" placeholder="Email"> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword">Password</label> <div class="controls"> <input type="password" id="passwd" placeholder="Password"> </div> </div> <div class="control-group"> <div class="controls"> <label class="checkbox"> <input type="checkbox"> Remember me </label> <input type="submit" class="btn btn-primary" value="Submit"/> <a href="register" class="btn btn-primary">Sign up</a> </div> </div> </form> </div> </div>Here's the command I'm giving in login.php:
echo "Email is:"; echo $_POST["email"]; echo "Password is:"; echo $_POST["passwd"];However all I'm getting is an empty array.
Is there some sort of special way I'm supposed to do this?
最满意答案
您没有在输入中定义名称只需从代码中更改两行。 添加该输入的名称。
<input type="email" id="email" name="email" placeholder="Email" /> <input type="password" id="passwd" name="passwd" placeholder="Password" />You have't define name in input just change two line from your code. add name of that input.
<input type="email" id="email" name="email" placeholder="Email" /> <input type="password" id="passwd" name="passwd" placeholder="Password" />更多推荐
class,<div,id,电脑培训,计算机培训,IT培训"/> <meta name="description&
发布评论