Skip to main content

index.php

<?php include('server.php') ?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="pdo.js"></script>
<link rel="stylesheet" type="text/css" href="pdo.css">
<title>PDO Registration forms </title>
</head>
<body>
<?php
if(isset($message))
{
echo '<label class="text-danger">'.$message.'</label> ';

}
?>
<h2> PHP login using PDO</h2>
<form method="POST" action="index.php">

<div class="inputs">
<label>Enter your username </label>
<input type="text" name="username">
</div>
<div class="inputs">
<label> Enter your Password</label>
<input type="Password" name="password">
</div>
<div class="inputs">
<input type="submit" name="login" value="LOGIN">
</div>
</form>
</body>
</html>

Comments

Popular posts from this blog

PDO Login Server

<?php session_start(); $host = "localhost"; $username = "root"; $password = ""; $database = "testdb"; $message = ""; try {     $conn = new PDO("mysql:host=$host;dbname=$database", $username, $password);     // set the PDO error mode to exception     $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if(isset($_POST["login"])) {     if(empty($_POST["username"]) || empty($_POST["password"]))     {         $message = '<label> All fields are required</label>';     }     else     {         $query = "SELECT * FROM users WHERE username = :username AND password=:password";         $statement = $conn->prepare($query);         $statement-> execute(                     array(                 ...