RE: [PHP-DB] another newbie question...
| From: | Jackson Miller | Date: | Mon, 16 Sep 2002 15:03:33 +0000 |
| Subject: | RE: [PHP-DB] another newbie question... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21776@lists.php.net to get a copy of this message | ||
Like this:
<?php
if ("eddie" == $username)
{
header("Location: http://www.amazon.com");
}
else if ("Jackson" == $username)
{
header("Location: http://www.php.net");
}
?>
Why:
Conditions for if statements should be in parentheses
Checking equality is ==
Using one = sets the variable
Placing the username before the $username variable in the statement
ensures that if you accidently enter = instead of == it will fail
instead of setting the variable and passing.
The header() function is a great way to send http headers.
Hope this helps,
-Jackson