PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 23rd, 2000, 09:51 PM
cskoo cskoo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 49 cskoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
i always facing a problem in setting the cookie. the cookie that i set always return a empty value.
my code is as follw:
setcookie("weather", $location, time()+14400);
where the value of location is the value from selection list.
can somebody help me to solve this problem?

Reply With Quote
  #2  
Old June 23rd, 2000, 11:13 PM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

setcookie("weather", $location, time()+14400);
where the value of location is the value from selection list.


just check it out wether location value is passing to the function or not.

<?
if (!isset($location)){
$location="india";
}
setcookie("weather", $location, time()+14400);

?>

you can check it out wether your cookie is set up or not using ..

<?
if(isset($weather))
{
print $weather. "<BR>n";
}
else
{ print "No cookie has been set";

}
?>



------------------
SR -
shiju.dreamcenter.net

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
  #3  
Old June 26th, 2000, 12:18 PM
ujludwig ujludwig is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 63 ujludwig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
You do not have to specify the time... just test it this way first...

setcookie("weather", "india");


on submit, check to see if it was set ...

echo $weather;

Note: Cookies are directory sensitive in my experience with php.

Reply With Quote
  #4  
Old June 27th, 2000, 11:41 PM
gpolins gpolins is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 32 gpolins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
To expand upon what the previous member mentioned vaguely, you'd have to set the directory for your cookie if you want it to appear over your entire website. To set your cookie, you'd use:

setcookie("weather",$location,time()+14400,"/","www.myurl.com");

If you don't add in the last two variables, the cookie won't be recognized anywhere but in the directory you set it in...perhaps this is your problem. Not enough detail to determine. :-/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > cookie problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap