[英]tag <a onclick = file.php> and refresh page
I have a login form; 我有一个登录表格; this is a part of my code:
这是我的代码的一部分:
<form method="post" action="login.php" >
<label>Username</label>
<input type="text" name="username"/>
<br>
<label>Password</label>
<input type="password" name="password"/>
<br>
<div class="log"><a class="btn btn_red">Login</a></div>
</form>
What I expect is that this form redirect me to the "login.php" file, but it doesn't work. 我期望的是这种形式将我重定向到“ login.php”文件,但是它不起作用。 Where am I going wrong?
我要去哪里错了?
Thank u all. 谢谢大家
You have an anchor (with no href
attribute) and no button. 您有一个锚点(没有
href
属性)并且没有按钮。
You need a submit button 您需要一个提交按钮
<div class="log"><button class="btn btn_red">Login</button></div>
Try this 尝试这个
<form method="post" action="login.php" id="form1">
<label>Username</label>
<input type="text" name="username"/>
<br>
<label>Password</label>
<input type="password" name="password"/>
<br>
<div class="log"><button type="submit" class="btn btn_red" form="form1" value="Submit">Login</button></div>
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.