Posted by ED on 11/28/06 15:01
"Christoph Burschka" <christoph.burschka@rwth-aachen.de> wrote in message
news:4t2u5rF126odiU1@mid.dfncis.de...
> You can't send a Location header after sending cookies (which
> session_start() does).
>
> So you either need to find a way to reload without starting a session, or
> you need to print a <meta> refresh tag into the page to reload it...
Um, you sure about that?
The code below works fine here:
<?php
session_start();
if (! isset($_GET['refresh'])) {
setcookie('foo','Bar');
$_SESSION['foo'] = 'Bar';
header('Location:'.$_SERVER['PHP_SELF'].'?refresh=1');
} else {
echo 'page refreshed';
echo '<br />Session foo: '.$_SESSION['foo'];
echo '<br />Cookie foo: '.$_COOKIE['foo'];
}
?>
maybe the OP is outputting something (whitespace etc) prior to the
redirection?
cheers
ED
Navigation:
[Reply to this message]
|