Hi, i want a script that asks for a password (just say it is "Password1") and if you get it wrong it says "invalid password, please try again" and if you get it right it says "Thank you!" Thanks very much! Any help for this simple script will be greatly appreciated.
<?PHP $password = $_POST['password']; if(isset($password)) { if ($password = "Password1") echo "Thank You!"; else echo "Invalid password, please try again."; } else { echo "<FORM ACTION=\".\" METHOD=\"POST\"> <label for=\"password\">Password:</label> <input type=\"password\" name=\"password\" /> </FORM>"; } ?> PHP: I'm not quite sure if this works P), so, pray, tell me if it does.
It says: Parse error: syntax error, unexpected '&' in /home/undergs3/public_html/activatepassword/index.php on line 5
The "unexpected &" is from a something else in the file. <?php $password = "foo"; if(isset($_POST['submit'])) { if ($_POST['password'] == $password) { echo ("Thank You!"); } else { echo ("Invalid password, please try again."); } } else { ?> <form method="POST"> <p><label>Password</label><input type='password' name='password' /></p> <p><input type='submit' name='submit' value='go' /></p> </form> <?php } ?> Code (markup):