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. Where am I going wrong?
Thank u all.
You have an anchor (with no href
attribute) and no button.
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.