First file:-
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="mexp_css.css">
<title>php_main3_feed</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
$a=$_POST['fname'];
$b=$_POST['email'];
$c=$_POST['cnum'];
setcookie("c1",$a,time()+3600);
setcookie("c2",$b,time()+3600);
setcookie("c3",$c,time()+3600);
}
?>
<div>
<b>
<table border="1">
<form method="POST" action="">
<tbody>
<tr>
<td> <label> First Name </label> </td>
<td> <input type="text" name="fname" placeholder=" First name"> </td>
</tr>
<tr>
<td> <label>Email</label> </td>
<td> <input type="text" name="email" placeholder=" example@exampl.com"> </td>
</tr>
<tr>
<td> <label>Contact_no</label> </td>
<td> <input type="number" name="cnum" placeholder="9999999999"> </td>
</tr>
<tr>
<tr>
<td> <input type="submit" value="Submit" name="submit"> </td>
<td> <input type="reset" value="Reset" name="reset"> </td>
</tr>
</tbody>
</form>
</table> </b>
</div>
</body>
</html>
**Second file**
<?php
echo "First name:-".$_COOKIE['c_fname']."<br>";
echo "Email:-".$_COOKIE['c_email']."<br>";
echo "Contact number:-".$_COOKIE['c_cnum']."<br>";
?>
Description:- I have set cookie in first file and I want to retrieve them in second file but it displays this error.
Error:-
Notice: Undefined index: c_fname in C:\xampp\htdocs\My PHP\Main\18_2\php1.php on line 2 First name:-
Notice: Undefined index: c_email in C:\xampp\htdocs\My PHP\Main\18_2\php1.php on line 3 Email:-
Notice: Undefined index: c_cnum in C:\xampp\htdocs\My PHP\Main\18_2\php1.php on line 4 Contact number:-