<?php 
if($_SERVER["REQUEST_METHOD"] == "POST"){
    $first_name =$_POST['first_name'];

    setcookie("fname", $first_name);
    echo("<h3>A cookie has been ser in your browser, it's name is fname. </h3>");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Set Cookies</title>
</head>
<form method="POST">
    Enter your name, and I will set a cookie with it.
    <input type="text" name="first_name">
    


</html>