Hello, I'm trying to password protect a page with PHP, using forms and $_POST data and all that stuff. However, I'm running into problems setting it so that if the POST is equal to a certain thing, it'll do this or that (using if...else commands) and also problems with just getting blank pages whenever I use the if...else commands. I tried this two different ways, illustrated below.
Here is what my original log in page 1 looks like. <?php echo <<<_HTML_ <form method="post" action="testing2.php"> Username: <input type="text" name="user"> <br> <input type="submit" value="submit"> </form> _HTML_; ?> This page shows up ok, with the form generating just fine. The problem is when I get to the action page, testing2.php. Here is that: <?php if ($_POST['user']) == me { echo "it's me!"; } else { echo "not me"; ?> This page just shows up as blank (after I submit on the log in page). What am I doing wrong? Also, I tried putting it all one page using if...else and $_SERVER[PHP_SELF] like this: <?php // print if form was submitted if ($_POST['user'] { echo "hey it works"; } else { // if they are just viewing the page for first time echo <<<_HTML_ <form method="post" action="$_SERVER[PHP_SELF]"> Username: <input type="text" name="user"> <br> <input type="submit" value="submit"> </form> _HTML_; ?> However, all I get is a blank page on this one as well. What am I doing wrong? Help sincerely appreciated, Andrew