Page 1 of 1

PHP in html files

Posted: Wed Jan 04, 2006 8:19 pm
by jaymoore_299

Code: Select all

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
</style>


<?php
$url="COOKIES";
setcookie ("visitor_", "", time()-3600); 
setcookie ('visitor_', $url, time() + (60*60*24),'/','.abcde.com');
?>

</head>
<body>
</body>
</html>
This is in a file cookie.html . When I run this I don't see any cookie made for my domain (ex: abcde) or with www in front of it. When I put just the php code in a php file and run that then the cookie is made fine.

Posted: Wed Jan 04, 2006 9:45 pm
by spamyboy
are you sure that PHP scripts works in HTML files :)?

Posted: Thu Jan 05, 2006 6:54 am
by sheila
And cookies need to be set before any output to the browser, i.e., before any HTML is printed.