Computer Hope

Software => Computer programming => Topic started by: Teale on October 26, 2016, 09:11:37 AM

Title: Small issue with using PHP with bootstrap forms.
Post by: Teale on October 26, 2016, 09:11:37 AM
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 * FROM users WHERE username ='".$username."' AND password = '".$password."' LIMIT 1";
$res mysql_query($sql);
if(mysql_num_rows($res) == 1){
echo "You have successfully logged in.";
exit();
}
else {
echo"Invalid login information.";
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>