# PLEASE HELP complete idiot...(php login form)

**URL:** <https://forum.kirupa.com/t/please-help-complete-idiot-php-login-form/69129>\
**Category:** programming\
**Created:** [November 1, 2004, 7:59pm UTC](https://forum.kirupa.com/t/please-help-complete-idiot-php-login-form/69129 "2004-11-01T19:59:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kathari](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@kathari](https://forum.kirupa.com/u/kathari)\
**Post date:** [November 1, 2004, 7:59pm UTC](https://forum.kirupa.com/t/please-help-complete-idiot-php-login-form/69129/1 "2004-11-01T19:59:31Z")

</div>

Please  
can someone help me find a simple tutorial or script on how to make a login page with a form for username and password, that will redirect through the header if the username and password are correct. I have tried doing this with a book and a php-forum but with no result really. I got this far. It doesn’t “accept” the password however and I get a header saying …php?Message=Invalid.  
Here is the code:

```php
<?php
if (( $_POST ['username'] == "larry") && ($_POST ['password'] == "opensesame" )) { 
print "valid";
}
?><title>LOG - IN</title>
<form method="post" action="HandleLogin.php">
<center><p>PLEASE FILL IN:</p>
<p>Username:*<input type="text" name="username"></p> 
  <p>
    Password:*<input type="text" name="password">
    <br>
    <br>
    <input type="submit" name="submit" value="SUBMIT">
  </p></center>
</form>

```

on the HandleLogin.php I have:

```php
<?php
if(($password=="opensesame") && ($username=="larry")){
header("Location:index.php?username=$username");
exit;
} else {
header("Location:login2.php?Message=Invalid");
exit;
}
?>

```

Hoping for help!
