You are on page 1of 1

html

<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br>
<input type="submit" value="Log in">
</form>
php
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Retrieve the username and password from the form
$username = $_POST["username"];
$password = $_POST["password"];
// Check if the username and password are correct
if ($username == "myusername" && $password == "mypassword") {
// Log the user in
header("Location: dashboard.php");
exit();
} else {
// Display an error message
echo "Invalid username or password.";
}
}
?>

You might also like