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 15th, 2000, 02:54 PM
brett_webb brett_webb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: NY, NY,USA
Posts: 18 brett_webb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am not having any trouble setting a cookie, but am having trouble reading the cookie from another page. Could someone tell me what I'm doing wrong here? The first page sets the cookie the second page is supposed to read the cookie and say that it worked.

Thanks
--------------------------
index.php3 follows:

<?php
setcookie("flashtest","1");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>
<?php print $flashtest; ?>

<a href="second.php3">Next</a>

</body>
</html>


second.php3 follows:
<?php
if (isset($testcookie)){
?>
<HTML>
<HEAD><TITLE>It worked</TITLE>
</HEAD>
<BODY>

<H1>It worked</H1>
<?php
print $testcookie;
}
else { ?>
<HTML>
<HEAD>
<TITLE>It didn't work</TITLE>
</HEAD>
<BODY>
<H1>It didn't work</H1>
<?php print $testcookie; } ?>
</BODY>
</HTML>



Reply With Quote
  #2  
Old June 15th, 2000, 04:00 PM
boo boo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 7 boo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
brett_webb,

<notice>I could be completely wrong because I'm new to PHP also</notice>

Could the reason you can't read the cookie be because you aren't calling it by the same name that you set it with.

Try:

<?php
if (isset($flashtest)){
?>

That should work, I think. If not, go to http://www.php.net/manual/html/function.setcookie.html to solve your problems.

John



Reply With Quote
  #3  
Old June 15th, 2000, 04:09 PM
brett_webb brett_webb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: NY, NY,USA
Posts: 18 brett_webb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
So it's been a long week and I'm losing it. Thanks for pointing out that idiocy on my part.

Reply With Quote
  #4  
Old June 15th, 2000, 06:19 PM
boo boo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 7 boo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No problem. I've asked so many questions in forums, it's about time I could answer a few!

John


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Reading from a 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