How to create a login page using HTML, CSS, JAVASCRIPT & PHP

Here is a simple example of a login page using HTML, CSS, JavaScript, and PHP:

HTML:

				
					<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div class="login-form">
      <form action="login.php" method="post">
        <h2>Login</h2>
        <div class="form-group">
          <input type="email" name="email" placeholder="Email" required>
        </div>
        <div class="form-group">
          <input type="password" name="password" placeholder="Password" required>
        </div>
        <div class="form-group">
          <button type="submit" name="login-button">Login</button>
        </div>
      </form>
    </div>
  </body>
</html>

				
			

CSS:

				
					body {
  background-color: #f2f2f2;
  font-family: Arial, sans-serif;
}

.login-form {
  width: 400px;
  margin: auto;
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
}

.form-group {
  margin-bottom: 20px;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

button[type="submit"] {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  background-color: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

				
			

PHP:

				
					<?php

if (isset($_POST['login-button'])) {
  $email = $_POST['email'];
  $password = $_POST['password'];

  // Check if the user's credentials are correct

  // If correct, start a session and redirect the user to the dashboard
  session_start();
  $_SESSION['user'] = $user;
  header("Location: dashboard.php");

  // If incorrect, display an error message
  echo "Incorrect email or password.";
}

?>

				
			

Note: This is just a basic example to get you started. In a real-world scenario, you would need to add additional error handling and security measures, such as password hashing and validation, to your code.