RE: [PHP-WIN] Cookies do not work
| From: | brother - Martin Bagge | Date: | Mon, 23 Sep 2002 08:21:00 +0000 |
| Subject: | RE: [PHP-WIN] Cookies do not work | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15952@lists.php.net to get a copy of this message | ||
You cannot use the cookies in the same as you stated them.
http://www.php.net/manual/en/function.setcookie.php
see common pitfalls.
You have to do it like: set cookie > new page to check the cookies.
/brother
> -----Original Message-----
> From: Sjaak [mailto:sjaak000@zonnet.nl]
> Sent: den 23 september 2002 09:15
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Cookies do not work
>
>
> Dear all,
>
> I have a Windows2000 server with PHP & IIS5
>
> My customer has written the following script:
>
>
>
>
> <?php
> //Verbinding maken met de database
> include("db/beheer/dbconnect.php");
>
> setcookie('test','Dit komt uit een
> cookie!!',time(0)+3600,'/','',0);
>
>
> echo "<br><table align='center'><tr><td><font
>
> size='+1'><b>Openingstijden:</b></font></td></tr></table><br>";
>
> $query = mysql_query ("SELECT * from openingstijden");
>
> echo "<table align='center' border='1'>";
> echo
>
> "<tr><td><b>Nr.</b></td><td><b>Vestiging</b></td><td><b>Maanda
> g</b></td><td>
> </td></tr>";
>
> //$teller = 1;
> while ($row = mysql_fetch_array ($query))
> {
> echo "<tr><td>".$teller."</td>";
> echo "<td>";
> if ($row['vestigingid'] == 1)
> {
> echo "Trio woonplaza / Profijtmeubel";
> }
> if ($row['vestigingid'] == 2)
> {
> echo "Trendhopper Druten";
> }
> if ($row['vestigingid'] == 3)
> {
> echo "Trendhopper Arnhem";
> }
> echo "</td>";
>
> echo "<td>van ".$row['maandagopen']." tot
> ".$row['maandagsluiten']."</td>";
> $teller = $teller+1;
> echo "</tr>";
> }
> echo "</table>";
>
> if (empty($HTTP_COOKIE_VARS))
> {
> echo "<br><center><b>KAN GEEN COOKIE VINDEN
> :-(</b></center>";
> }
> else
> {
> $cookie = $HTTP_COOKIE_VARS["test"];
> echo "<br><center><b>COOKIE GEVONDEN!! inhoud =
> ".$cookie."</b></center>";
> }
>
> ?>
>
>
> But when displaying we cannot get the cookie been displayed.
> Also after
> refresh the browser.
>
> Does anyone has an idea? Setting in my PHP.INI?
>
> Please help me!
>
> Cheers,
> Jacco
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>