Whats the error in code?
hi...
When i run below code, getting an notice undefined index username and colorchoice, whats the mistake in that code?
also im not getting 'PHP_SELF'.. why we hav e to use tat?
cookie1.php
<?php
$user = $_POST['username'];
$color = $_POST['colorchoice'];
$self = $_SERVER['PHP_SELF'];
if( ( $user != null ) and ( $color != null ) )
{
setcookie( "firstname", $user , time() 86400 ); // 24 hours
setcookie( "fontcolor", $color, time() 86400 );
header( "Location:cookie2.php" );
exit();
}
?>
cookie2.php
<?php
if (isset($_COOKIE['firstname']))
{
$user = $_COOKIE['firstname'];
$color= $_COOKIE['fontcolor'];
}
?>