473,791 Members | 3,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to retrieve cookies ?

2 New Member
i have written following code for setting & retrieving cookies:-

Expand|Select|Wrap|Line Numbers
  1. $lang = 'french';
  2. setcookie('TRADE_LANGUAGE', $lang, time()+3600);
  3. print_r($_COOKIE);
but while printing it gives only one that is "Array ( [PHPSESSID] => 3p4l3oq93b5tet0 r7lea77tca0 ) "

i have checked in my browser 2 cookies are been created PHPSESSID & TRADE_LANGUAGE but while printing only one gets printed,

can someone pls tell what can be issue?

Thanks,
nishika
Feb 2 '10 #1
2 1835
dgreenhouse
250 Recognized Expert Contributor
The cookie is not going to show up until the second visit to a page on the site.

In other words...

1- On page one a cookie is set
2- The user navigates to a different (or same page)
3- The cookie that was set on the first visit is now available

The reason that your PHPSESSID cookie was available is because it was already set.

It can get more involved than that, but these are the basics.

3.2 How does a cookie really work?
Feb 2 '10 #2
nishika
2 New Member
Thanks for response i got the answer
i reloaded the page so i can use the set cookie :)
Feb 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
11201
by: David Rasmussen | last post by:
Some sites seem to be session driven in the sense that if I visit the homepage and do a few clicks I can navigate anywhere I want, but if I paste the current location into a new browser window after having navigated to some page, it doesn't work. It just returns to the start page or says "timeout" etc. This means that I can't read these pages from PHP with $string = file_get_contents('http://some.url/blah/deep/link');
9
3726
by: Colin Graham | last post by:
hi folks, just wonder if this is possible or is there a better way of doing this. i need to store values in cookies between two forms. the details are added in a popup when this is closed the main form stores these values in hidden fields. at this point xml is built up and submitted to a biztalk server. if there is an error the page is refreshed and the initial values i added via the popup are lost. my idea was to store these as...
3
2197
by: James Geurts | last post by:
This is probably more of an ASP.Net situation rather than c#, but since all of my code behind is in c#, maybe it fits here. I'm wondering, generally, at what point is it too inefficient to store information in a client cookie rather than retrieve it from a datastore. Now, I see the advantage of not storing it in a cookie, but a lot of programs already use cookies to store things from user credentials (roles) to specific user settings....
2
2089
by: Jim | last post by:
Hi, I'm working on an intranet site for a large client who has a search routine that runs on another intranet site on a different server. This search routine saves its searches in cookies for re-use. My client would like to display those saved searches on their own page. Is there any way that I can retrieve cookies from another site? I think this is impossible and I'll have to use an IFRAME with content from the other site, but I'd...
1
2594
by: onceuponapriori | last post by:
Greetings gents. I'm a Railser working on a django app that needs to do some scraping to gather its data. I need to programatically access a site that requires a username and password. Once I post to the login.php page, there seems to be a redirect and it seems that the site is using a session (perhaps a cookie) to determine whether the user is logged in. So I need to log in and then have cookies and or sessions maintained as I access...
4
1598
by: Jeff | last post by:
hey ASP.NET 2.0 I'm preparing for a certification exam on asp.net 2.0 and yesterday I took a skill assessment test on microsoft.com. One of the questions was about creating cookies. This was the question: "Which object or objects will you use to create and retrieve cookies"... 6 alternative answer were listed, below I show only 2 most relevant alternatives
1
1439
by: GpOscar | last post by:
Hey whats up.. i have created a form which does calculations i have installed it on the server and run on it all the other workstations. Now on this form there are some rates that change according to calculations. how can i retrieve the cookies from the server rather than stored on each individual workstation.? so that all the workstations have the same new rates.
1
1563
by: yootaeho | last post by:
Hi, I have the following script <%@LANGUAGE=Javascript%> <% var myClass = new LoginInfo(); myClass.sessionID = "1321312131"; Response.Cookies("testingCookies") = myClass; var recievedCookies = new LoginInfo();
2
5326
by: Josh T | last post by:
As of now I am setting a cookie on my aspx page via javascript, function SetCookie(cookieName, value, minutesToExpire) { ClearCookie(cookieName); var expireDate = new Date(); var cookieValue; expireDate.setMinutes(expireDate.getMinutes() + minutesToExpire);
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.