What common mistakes are beginners likely to make when setting and using cookies in PHP?

One common mistake beginners make when setting cookies in PHP is forgetting to call the `setcookie()` function before any output is sent to the browser. This is because headers must be sent before any content. To solve this issue, make sure to set cookies before any HTML or text is echoed or printed to the browser.

<?php
// Correct way to set a cookie
setcookie("username", "JohnDoe", time() + 3600, "/");
?>