I have checked the code many times, yet not able to find the error! the issetCookie returns false here.
<html>
<body>
<?php if(!isset($_REQUEST['sub'])) { ?>
<form name="f1" action="1.php" method="post">
Name : <input type="text" name="na"><br>
Last Name : <input type="text" name="lna"><br>
Email Id : <input type="text" name="eml"><br>
Phone No : <input type="text" name="phn"><br>
City : <input type="text" name="cty"><br>
<input type="Submit" name="sub" value="ok"><input type="Reset" name="res" value="Clear">
<?php } else {
$name=$_REQUEST['na'];
$lname=$_REQUEST['lna'];
$email=$_REQUEST['eml'];
$phone=$_REQUEST['phn'];
$city=$_REQUEST['cty'];
setcookie("Name", $name, time()+3600, "/","", 0);
setcookie("LName",$lname);
setcookie("Email",$email);
setcookie("Phone",$phone);
setcookie("City",$city);
} ?>
</form>
</body>
</html>
Can someone help me to assign variables to cookie? If its the issue of else, please suggest alternate options of assigning cookie value using form data and retrieving on the next page defined in form action.