I'm trying to read a cookie that I set with javascript with php. I've tried many websites and nothing I've found works at ALL (except var_dump() printed up null) but other then that all I've gotten is a blank page.
Here is what I've tried...
(page1.php)
[code=javascript]
<script>
createCookie('n ame','jim',7)
function createCookie(na me,value,days) {
if (days) {
var date = new Date();
date.setTime(da te.getTime()+(d ays*24*60*60*10 00));
var expires = "; expires="+date. toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+ expires+"; path=/";
}
</script>
[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
(page2.php)
[code=php]
<?php
$var1=$_COOKIE['name'];
echo $var1;
?>
[/code]
I've also tried...
[code=php]
<?php
$var1=var_dump( $_COOKIE['name']);
echo $var1;
?>
[/code]
but so far nothing has happened.
Here is what I've tried...
(page1.php)
[code=javascript]
<script>
createCookie('n ame','jim',7)
function createCookie(na me,value,days) {
if (days) {
var date = new Date();
date.setTime(da te.getTime()+(d ays*24*60*60*10 00));
var expires = "; expires="+date. toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+ expires+"; path=/";
}
</script>
[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
(page2.php)
[code=php]
<?php
$var1=$_COOKIE['name'];
echo $var1;
?>
[/code]
I've also tried...
[code=php]
<?php
$var1=var_dump( $_COOKIE['name']);
echo $var1;
?>
[/code]
but so far nothing has happened.
Comment