I am fairly new to PHP and am trying to embed a php script into a frame (Web Presence Builder / Parallels) which sets 2 cookies for a webpage. I am using the following code to set the cookies.
$hour = time() + 3600;
setcookie("Cookie1", $_POST['username'], $hour, '.mydomain.com');
setcookie("Cookie2", $_POST['pass'], $hour, $hour, '.mydomain.com');
The cookies are not set, however, when I run the same script on a blank page (same server, no html or css), the cookies are set. I have read the documentation where it states
Like other headers, cookies must be sent before any output from your script...
Is there a way to insert the script in order for the cookies to be set?
Thanks.