<?php
$fruit = $_GET["fruit"];
$koekje = setcookie("fruitstuk", $fruit, time()+10);
$test = $_COOKIE["fruitstuk"];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method="get">
Sla een fruit op: <input type="text" name="fruit">
</form>
<?php
echo $test;
echo $koekje;
echo $fruit;
?>
</body>
</html>
Made by Thijs Aarnoudse