RE: [PHP-DB] another newbie question...
| From: | (Edward Peloke) | Date: | Mon, 16 Sep 2002 15:39:38 +0000 |
| Subject: | RE: [PHP-DB] another newbie question... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21777@lists.php.net to get a copy of this message | ||
So, I would actually use this code somewhere in the page that has the form
to enter the username to send to a blank page that then redirects based on
the username? I tried to put it in the page that is called by the form
action on the form page but I get a warning that:
Warning: Cannot add header information - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\redirect.php:1) in
c:\program files\apache group\apache\htdocs\redirect.php on line 5
So I assume I need to add it to the signin page to send..correct?
Thanks for being patient with me,
Eddie
-----Original Message-----
From: Jackson Miller [mailto:lists@jaxn.org]
Sent: Monday, September 16, 2002 11:04 AM
To: 'Edward Peloke'; php-db@lists.php.net
Subject: RE: [PHP-DB] another newbie question...
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php