|
Posted by Frits van Leeuwen on 10/11/68 11:59
> > I call from index.php this file: (Taal_nl)
> >
> > <?php
> > setcookie("LeeuwendeelTaal", "nl", time()+3600*24); // 1 dag
> > echo "Cookie is: ". $_COOKIE["LeeuwendeelTaal"] . '<br>';
> > echo "Cooke is: ". $LeeuwendeelTaal;
> > header('Location: http://www.Leeuwendeel.info/index.php');
> > exit;
> > ?>
>
> You can't set a Header after you have sent any page content.
>
> You may achieve what you want using 'index.php' with:
>
> <?php
> setcookie("LeeuwendeelTaal", "nl", time()+3600*24); // 1 dag
> header('Location: http://www.Leeuwendeel.info/main.php');
> ?>
>
> Then simply put the rest of the initial page in 'main.php'
>
In index.php, I use the following lines:
<!--NL-->
<a href="taal_nl.php"><img border="0" src="knoppen/vlagNL.jpg"
width="33" height="20" alt="Klik hier, wanneer u de site in het Nederlands
wilt lezen."></a>
In taal_nl.php you can read now:
<?php
setcookie("LeeuwendeelTaal", "nl", time()+3600*24); // 1 dag
header('Location: http://www.Leeuwendeel.info/main.php');
?>
or
<?php
setcookie("LeeuwendeelTaal", "nl", time()+3600*24); // 1 dag
header('Location: http://www.Leeuwendeel.info/main.php');
exit;
?>
both do not work. I used the echo commands in this file to see if it works.
I think, setcookie needs more time to set a cookie.
Navigation:
[Reply to this message]
|