I need to execute a javascript code into which I have to set some cookie info, redirect to a php page and get such info by php code. I must not use such info as url parameters to transfer to php.
I tried this in javascript:
currentClass = {
'date': '..some date..',
'time': '..some time..',
'instructor': '..some instructor..'
}
var result = JSON.stringify(currentClass);
var date = new Date();
date.setTime(date.getTime()+3600);
document.cookie = "BOOKING_CLASS=" + result + "; expires=" + date.toGMTString() + ";";
window.location.href = '/apps/mindbody/add/bookingmember';
location /apps/mindbody/add/bookingmember is routing by .htaccess apache file to a specific php file
The PHP contains:
if (!isset($_COOKIE['BOOKING_CLASS'])) {
show_error();
}
The only data that $_COOKIE has is PHPSESSIONID so such required cookie is not present and error is shown.
I tried setting the path and domain without success!
document.cookie = "BOOKING_CLASS=" + result + "; expires=" + date.toGMTString() + "; path=/apps/mindbody/add/bookingmember; domain=mydomain.com";
when running, browser stop on breakpoint to show cookies value:
Following is the browser cookie value:
No set cookie value exists in PHP.
Thanks for any help


