On the page with the form, i check to see if there is reason to echo the error (if isset $_GET['i']; .. )
And then echo the cookie out.
Hooooowever, it seems the cookie isn't being recognised or i'm just silly silly silly!
Code: Select all
// setting the cookie
setcookie('Signup_Error', "Both username and email address have been taken! Please try again", time() + 3600);
header("Location: http://localhost/blog.mahcuz.com/?i");
Code: Select all
// retrieving the cookie
<?php
if(isset($_GET['i']))
{
$_error = $_COOKIE['Signup_Error'];
?>
<div id="error_signup">
<?php
echo $_error;
?>
</div>
<?php
}
?>
If i am to cancel the header redirect and just echo the cookie out as soon as it is set, it works fine
Code: Select all
// setting the cookie
setcookie('Signup_Error', "Both username and email address have been taken! Please try again", time() + 3600);
echo $_COOKIE['Signup_Error'];
// header("Location: http://localhost/blog.mahcuz.com/?i");