FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


cookies (yumm)





m-productions
Ok... i dont know whats wrong, i have two files

sigh2.php
Code:

<?php
setcookie ("mtest", "This text will be in the cookie", time( ) + 3600);
?>



sigh.php
Code:

<?php
print " this is a test $mtest ";
?>


but, it just shows "this is a test" and when i look in my cookie folder, there is no cookie.

note:
Code:

$_COOKIE['mtest']

still dosnt do anything, like i said, the problem is that the cookie isnt being made in the first place.
brokenadvice
I don't think you can call a cookie from a variable like that.

To set:
Code:

<?php
$value = 'Blah Blah';
setcookie("mtest", $value, time()+3600);
?>


And to view:

Code:

<?php
echo $_COOKIE["mtest"];
echo $HTTP_COOKIE_VARS["mtest"];

?>

From: http://us.php.net/setcookie
m-productions
brokenadvice wrote:
I don't think you can call a cookie from a variable like that.

To set:
Code:

<?php
$value = 'Blah Blah';
setcookie("mtest", $value, time()+3600);
?>


And to view:

Code:

<?php
echo $_COOKIE["mtest"];
echo $HTTP_COOKIE_VARS["mtest"];

?>

From: http://us.php.net/setcookie


you should be able to call a cookie just using $cookiename as i have register_globals on, and anyway the display isnt the problem, because the cookie isnt being made in the first place.


however, using your method for making it works, ... bah.. the site i used needs to fix their information then!
DanielXP
Add "ob_start();" to the top of your pages.

Code:
<?php
ob_start();
$value = 'Blah Blah';
setcookie("mtest", $value, time()+3600);
?>
thinkingskull
I think cookies r not enabled on ur comp.... k y not use sessions...????
Related topics
avoid super cookies
recipie for chocolate chip cookies
Introduction To Cookies :
PHP: Sessions and Cookies
Help for sending 2+ cookies in one page.
[php/cookies] poll on two sites
PHPBB Cookies
FireFox and Cookies/Sessions
using cookies in PHP
My forum isn't saving cookies
End of the world: Our cookies are running out
what is better? Sessions or Cookies
Mom Said to Help Girls Bake Ex-Lax Cookies
Cookies?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.