<form method=post action=cookies_redirect.php>
Enter Your Name <input type=text name=name class='form-control'>
<input type=submit value=Next class='btn btn-danger'>
</form>
Code for page cookies_redirect.php
<?Php
$name=$_POST['name'];
if(isset($name) and strlen($name) > 1){
setcookie ("Plus2netCookie", $name,time()+3600);
header ("Location: cookies_t2.php");
}else{
echo " Input your name first and then click NEXT button
<input type='button' value='Back' onclick='window.history.back()' />";
}
?>
Tutorial on PHP Cookies Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.