Re: [PHP] Check multiple cookies

2001-05-22 Thread Sam Gooding

At 05:04 PM 5/21/01 +0100, James Holloway wrote:
Hi Sam,


  The following is exactly what I typed in (just copy and pasted) but I'm
  still getting the error:
 
  Cannot add header information - headers already sent by (output started at
  web.php:2) in
  web.php on line 19

Make sure that all output for Cookies and header information is sent before
any HTML, and that there is no whitespace before the initial ? tag - that's
probably the source of the problem.

Have a search for Output buffering on the PHP main site.

I have created a cookie that I can read in ASP using the following:

response.write Request.Cookies(cookie1)  p

However PHP will not output the value from the following statement:

$cookie1 = $HTTP_COOKIE_VARS[cookie1];

and if fact returns the error:

Undefined index: cookie1

Anybody have any idea why that might be?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Check multiple cookies

2001-05-21 Thread Sam Gooding

Is it possible to check multiple cookie values and then redirect to another 
page depending on what cookie values have been set?  Sort of like:

if(cookie == 3)
   goto(url1)
elseif(cookie2 = 5)
   goto(url2)
else
   goto(url3)

Thanks in advance!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Check multiple cookies

2001-05-21 Thread Sam Gooding


At 09:31 AM 5/21/01 -0500, you wrote:
header(Location: http://www.example.com;);

That redirects the user to the wepage of you're choosing. The rest is just a
matter of checking variables. For instance, you can do this:

if ($var1)
{
$url = 'www.example1.com';
}
elseif ($var2)
{
$url = 'www.example2.com';
}
elseif ($var3)
{
$url = 'www.example3.com';

header(Location: $url);


Obviously there are endless ways to do it, but that's the basic idea.

The following is exactly what I typed in (just copy and pasted) but I'm 
still getting the error:

Cannot add header information - headers already sent by (output started at 
web.php:2) in
web.php on line 19

?
if ($var1)
{
$url = 'www.example1.com';
}
elseif ($var2)
{
$url = 'www.example2.com';
}
elseif ($var3)
{
$url = 'www.example3.com';
}
else
{
$url = 'www.example4.com';
}

header(Location: $url);


?

Sam Gooding [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Is it possible to check multiple cookie values and then redirect to
another
  page depending on what cookie values have been set?  Sort of like:
 
  if(cookie == 3)
 goto(url1)
  elseif(cookie2 = 5)
 goto(url2)
  else
 goto(url3)
 
  Thanks in advance!
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]