note 19544 added to language.types.null
| From: | joemamacow at hotmail dot com | Date: | Sat, 02 Mar 2002 19:12:36 +0000 |
| Subject: | note 19544 added to language.types.null | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27281@lists.php.net to get a copy of this message | ||
I have particularly found that the NULL value is very helpful when using form and script on the same
page.
For example:
if(isset($password) AND $password = $passwd):
{
echo "You're logged in!";
}
elseif(isset($password) AND $password != $passwd):
{
$password = NULL;
echo "Sorry, wrong password, <a href=$PHP_SELF>log in again</a>.";
}
else:
{
echo "Log in!
<input type=text name=password>
<input type=submit>";
}
endif;
So, when the user geta the wrong password message, the password is set to NULL, making it unset,
therefore when the page is refreshed, it will go back to the password from.
--
http://www.php.net/manual/en/language.types.null.php
http://master.php.net/manage/user-notes.php?action=edit+19544
http://master.php.net/manage/user-notes.php?action=delete+19544
http://master.php.net/manage/user-notes.php?action=reject+19544