samedi 12 mai 2018

Why my PHP form doesn't work? [on hold]

I'm making chat with first page, that redirects you after entering password. Maybe there's a silly mistake in the code, because I'm beginer. The code:

<?php
session_start();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta chartset="utf-8">

        <title>Chat</title>

        <link rel="stylesheet" href="style.css" type="text/css">
        <link href="https://fonts.googleapis.com/css?family=Merienda+One" rel="stylesheet">

         </head>
    <body>

            <form method="post">
                <label>Enter password:</label>
        <input type="password" name="pass">
        <input type="submit" name="submit">

            </form>
                <?php
if ($_POST) {
    $password=$_POST['pass'];
    if ($password=="lol") {
        $_SESSION['password']=$password;
        header('Location: chat.php');
        }
    else{
     echo ("Wrong password");
        };
?>
    </body>
</html>




Aucun commentaire:

Enregistrer un commentaire