I have a vague understanding of the relationship between a session and cookie(s) in php. From my understanding cookie is supposed to aid implementation of session for a client at the server side, But I need clarification on some experiment I conducted today.
<?php
session_start();
setcookie("userCookie", "myCookie");
if( isset($_GET["sessName"]) && isset( $_GET["sessValue"] ) ) {
$_SESSION[filter_input(INPUT_GET, "sessName")] = filter_input(INPUT_GET, "sessValue");
}
foreach ($_SESSION as $sessNames){
echo $sessNames;
}
?>
<form method="GET">
<input type="text" name="sessName" placeholder="Session Name">
<input type="text" name="sessValue" placeholder="Session value">
<input type="Submit" >
</form>
?>
If I supply a value "foo" into session Name and submit then later delete userCookie from the browser "chrome" the user input will still remain in session. But if I delete "PHPSSID" cookie leaving "userCoookie" from browser, the user input will be lost. This brings me to the question of what practical benefit or use can be acheived in sending a client more than one cookie "PHP started managed cookie from session_start()