【发布时间】:2018-09-27 22:02:37
【问题描述】:
表单有问题。在 html 中,我有一个表单,我想通过 post 提交,使用 enctype multipart/form-data。 我在其他页面上多次使用该代码,但现在它没有提交数据。不知道为什么。以下代码来自我的脚本(不是全部,而是必要的部分)。
<?if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (isset($_POST['login'])) {
require 'login.php';
}
elseif (isset($_POST['register'])) {
require 'register.php';
}
}
?>
<div id="login" role="form" class="r_form_elements" style="display:none">
<form class="form-signin bg-dark text-light" method="post" action="index2.php" enctype="multipart/form-data" autocomplete="off">
<div class="text-center mb-4">
<h1 class="h3 mb-3 font-weight-normal">Login</h1>
</div>
<div class="form-label-group mt-3">
<label for="inputEmail">Email address</label>
<input type="email" id="inputEmail" name="email" class="form-control" placeholder="Email address" required="" autofocus="">
</div>
<div class="form-label-group mt-3">
<label for="inputPassword">Password</label>
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required="">
</div>
<label for="lang" style="display:none" class="sr-only">longitude</label>
<input type="text" style="display:none" name="lang" id="lang" class="form-control" required autofocus>
<label for="lat" style="display:none" class="sr-only">latitude</label>
<input type="text" style="display:none" name="lat" id="lat" class="form-control" required>
<button value="Login" name="login" class="btn btn-lg btn-primary btn-block mt-3" type="submit">Sign in</button>
<p class="mt-5 mb-3 text-muted text-center">By signing in you agree to the <a href="tos">Terms of Service</a></p>
</form>
</div>
这通常应该将数据提交到登录页面。但事实并非如此。根本没有反应或任何东西。好像浏览器无法识别提交按钮一样。
有人可以解释原因吗?我已经尝试了不同的位置来确定,但它没有帮助。
提前致谢。
【问题讨论】:
-
从隐藏标签和输入中删除所需