RE: [PHP-DB] New Thread name, was "Newbie Question"
| From: | Gary dot Every at ingramentertainment dot com | Date: | Mon, 16 Sep 2002 16:02:37 +0000 |
| Subject: | RE: [PHP-DB] New Thread name, was "Newbie Question" | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21779@lists.php.net to get a copy of this message | ||
You'll have to use the if statements, and particularly the Header()
statement BEFORE sending any HTML
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php