No it won't make a cookie if ther is non?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
User avatar
Skywalker
Forum Contributor
Posts: 117
Joined: Thu Aug 29, 2002 3:33 am
Location: The Netherlands

No it won't make a cookie if ther is non?

Post by Skywalker »

It does not want to make a cookie if ther is no cookie, what am I doing wrong can somebody discribe it?


<?php

$NewNaam=$_POST["NewNaam"];

if (isset($_COOKIE['Naam'])) {
$Naam = "$NewNaam";


} else {

$NewNaam=$_POST["NewNaam"];
setcookie("Naam",$NewNaam,time()+40000,"/test/");
$Naam = "$NewNaam";
}


?>


Thx Skywalker
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

$NewNaam=$_POST["NewNaam"];

if (isset($_COOKIE['Naam'])) {
$Naam = "$NewNaam";
...

Why do you need to set $Naam = "$NewNaam" if the cookie is already set, surely it must contain the correct value in $Naam already?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

There is already a thread open with this topic in it, please do not cross-post.

Anybody trying to help could you please post your answer here:
http://www.devnetwork.net/forums/viewtopic.php?t=2650

Mac
Locked