1.

Solve : Small issue with using PHP with bootstrap forms.?

Answer»

I feel like I am so close to it working but for some reason it isnt.
I can't seem to get the button to run the PHP code, with a basic form (not using bootstrap) my php works but just not with this bootstrap.
Any help would be greatly appreciated.

Code: [Select]<?php
$host="localhost";
$USER="root";
$pass="pass";
$db="SheetPal";
mysql_connect($host,$user,$pass);
mysql_select_db($db);

if(isset($_POST['submit'])){
$username=$_POST['username'];
$password=$_POST['password'];
$sql="SELECT*FROMusersWHEREusername='".$username."'ANDpassword='".$password."'LIMIT1";
$res=mysql_query($sql);
if(mysql_num_rows($res)==1){
echo"Youhavesuccessfullyloggedin.";
EXIT();
}
else{
echo"Invalidlogininformation.";
exit();
}
}
?>

<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<link rel="stylesheet" href="css/login.css">

</head>

<body>

<body>
<div class="login">
<div class="login-screen">
<div class="app-title">
<h1>Login</h1>
</div>

<div class="login-form" role="form" method="post" action="test.php">
<div class="control-group">
<INPUT TYPE="text" class="login-field" value="" placeholder="username" name="username">
<LABEL class="login-field-icon fui-user" for="login-name"></label>
</div>

<div class="control-group">
<input type="password" class="login-field" value="" placeholder="password" name="password">
<label class="login-field-icon fui-lock" for="login-pass"></label>
</div>

<div class="control-group">
<input id="submit" name="submit" type="submit" value="Login" class="btn btn-primary">
</div>

<!-- <a class="btn btn-primary btn-large btn-block" href="test.php">login</a>
<a class="login-link" href="#">Lost your password?</a> -->
</div>
</div>
</div>
</body>




</body>
</html>



Discussion

No Comment Found