代码如下:
<form action="success.php" method="post">
<input type="text" name="username">
<input type="password" name="password">
<button type="submit" name="submit">注册</button>
<a href="login.php"><button>登陆</button></a>
</form>
<form action="success.php" method="post">
<input type="text" name="username">
<input type="password" name="password">
<button type="button" name="submit">注册</button>
<a href="login.php"><button type="button">登陆</button></a>
</form>
在这两种情况下,点击登录button是不会有反应的,正确代码应该如下:
<form action="success.php" method="post">
<input type="text" name="username">
<input type="password" name="password">
<button type="submit" name="submit">注册</button>
<a href="login.php"><button type="button">登陆</button></a>
</form>