I have a 4 option select with website names, which I want my code to redirect to that website. It works perfectly fine. I have added a checkbox and if the user checks that checkbox the option should be stored and when the user goes to the 4 option select should automatically be redirected whatever option the select was when the checkbox was checked. The cookie value of the website is not the name which I use to know what website the user selected, but a 32 long string (ex: ad05a843-cf49-4738-a188-6470ba192b22).
Here I set the cookie:
if(isset($_POST['save']))
{
setcookie('numeSite', $_POST['site-uri'], 100);
}
And here I check whether there is a cookie with the name of the saved site or not:
if (isset($_COOKIE['numeSite']))
{
echo "Am intrat";
if($_COOKIE['numeSite'] == 'amazon')
header("Location: https://www.amazon.com");
if($_COOKIE['numeSite'] == 'microsoft')
header("Location: https://www.microsoft.com/ro-ro");
if($_COOKIE['numeSite'] == 'flanco')
header("Location: https://www.flanco.ro/");
if($_COOKIE['numeSite'] == 'emag')
header("Location: https://www.emag.ro/");
}
How ma I supposed to make this work?