我正在开发一个使用PHP的网站,允许用户登录到系统。但我不知道是什么问题,当用户点击登录按钮,按钮停留在同一页而不是直接转到下一页。
你能帮我找出问题的原因吗?提前谢谢你!
<html lang="en">
<head>
<form action="login.php" method="post">
<form action="order.html" method="get">
<title>bAJu VALeT </title>
<style>
@import url(http://fonts.googleapis.com/css?family=Raleway:400,700);
body {
background: #7f9b4e url(img/v1.jpg) no-repeat center top;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.container>header h1,
.container>header h2 {
color: black;
text-shadow: 0 3px 3px rgba(0, 0, 0, 0.7);
}
</style>
</head>
<body>
<div class="container">
<header>
<center>
<h1><strong>WELCOME TO </strong> BAJUVALET </h1>
</center>
</header>
<center>
<section class="main">
<form class="form-4">
<h1>LOGIN</h1>
<p>
<form id="login" method="POST" class="form-signin" role="form">
<td>
<h2>Email:</td>
<td><input type="text" name="email">
<h2>
</td>
<td>Password:</td>
<td><input type="text" name="password"></td>
<form action="order.html" method="post">
<div <a href="order.html">
<td>
<h1><input type="submit" name="continue" value="CONTINUE">
<h1>
</td>
</div>
</form>
</form>
<label class="checkbox">
</p>
<p>
<form action="index.html">
</form>
<div class="login-links">
<a href="signup.php">
<p>
<a href="signup.php">
<h6>Don't have an account? <strong>Sign Up</strong><h6>
</p>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
</p>
</form>
</form>
</section>
</center>
</div>
</body>
</html>
发布于 2017-03-29 01:33:00
我不知道你为什么会有这么多的<form>标签,但是根据我从你的代码中推断出来的,你可能正在寻找类似这样的东西:
<html lang="en">
<head>
<title>bAJu VALeT </title>
<style>
@import url(http://fonts.googleapis.com/css?family=Raleway:400,700);
body {
background: #7f9b4e url(img/v1.jpg) no-repeat center top;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.container>header h1,
.container>header h2 {
color: black;
text-shadow: 0 3px 3px rgba(0, 0, 0, 0.7);
}
</style>
</head>
<body>
<div class="container">
<header>
<center>
<h1><strong>WELCOME TO</strong>BAJUVALET</h1>
</center>
</header>
<center>
<section class="main">
<h1>LOGIN</h1>
<p></p>
<form id="login" class="form-signin" role="form" method="POST" action="order.php">
<table border="1" cellpadding="">
<tr>
<td><h2>Email:</h2></td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td><h2>Password:</h2></td>
<td><input type="text" name="password"></td>
</tr>
<tr>
<td colspan="2">
<center>
<input type="submit" name="continue" value="CONTINUE">
</center>
</td>
</tr>
</table>
</form>
<a href="signup.php">
<h6>Don't have an account? <strong>Sign Up</strong></h6>
</a>
<p></p>
</section>
</div>
</body>
然后在order.php中
<?php
$email = $_POST["email"];
$password = $_POST["password"];
echo "Email: ".$email." Password: ".$password.".<br/>";
?>现在,一些重要的建议需要牢记在心:
有用的链接:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
https://stackoverflow.com/questions/43073899
复制相似问题