Professional Documents
Culture Documents
Webtech 8PRINT Final
Webtech 8PRINT Final
Aim: Write a PHP script for login authentication. Design an HTML form which takes
username and password from user and validate against stored username and password in
file.
Aman Malik
IT-E
00496303121
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Form</title>
</head>
<body>
<?php
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get user input
$username = $_POST["username"];
$password = $_POST["password"];
Aman Malik
IT-E
00496303121
}
?>
<h1>Login Form</h1>
<form action="login.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br>
Output:
Aman Malik
IT-E
00496303121