I created a test.html file and put this in it.
Code:<?php setcookie("test", "test1", time()+3600); ?> <html> <body> Test </body> </html>
Its not working... shouldn't that set the cookie ?
Could someone try it and tell me if it works for them ?
yourxamppdirectory/htdocs/
<?php
setcookie("test", "test1", time()+3600);
?>
<html>
<body>
Cookie value: <?php echo $_COOKIE["test"]; ?>
</body>
</html>
http://localhost/yourphpfile.php
Cookie value: test
It has to be a php file.
Since you put php code in an html file, I assume you're not familiar with web programming![]()
It doesn't need to be a php file, and yes it is running on a server that allows PHP. Try that code guys its good but its not working.