I am new to php programming. I designed a signup form for my site. After signup anyone can download some files in that site. Now I am looking for to set cookie for signup page.
<div class="field submit" style="text-align:center;">
<input type="submit" value="signup"/>
<?php
setcookie("signup",time()+3600, "/");
if (isset($_COOKIE['signup'])) {
print "<p>Hello $_COOKIE[signup]</p>";
} else {
print "<p>Hello, This is your first visit</p>";
}
?>
</div>
I am using the code like this but it was showing a warning.
Hello $_COOKIE['signup']
"; Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/clovefnm/public_html/Example/signup1/samplecook.php on line – Sujitha Apr 04 '14 at 08:32