I'm storing a multiple selection on page 1 PHP and would like to get the selected values in cookies/session.
<select multiple="multiple" name="subjects" size=3 multiple>
<option value="math">Mathematics
<option value="sci">Science
<option value="his">History
</select>
<?php
setcookie('subjects', $subjects);
?>
I would like to get the selected values in a page 2 PHP and print out some links:
<html>
<body>
<?php
if(isset($_COOKIE["subjects"])){
if ($_POST['subjects.value = math']) {
echo "https://en.wikipedia.org/wiki/Mathematics, https://www.niu.edu/mathmatters/everyday-life/index.shtml, https://en.wikipedia.org/wiki/Areas_of_mathematics <br />";
}
if ($_POST['subjects.value = sci']) {
echo "https://en.wikipedia.org/wiki/Science, https://en.wikipedia.org/wiki/Biology, https://en.wikipedia.org/wiki/Chemistry <br />";
}
if ($_POST['subjects.value = his']) {
echo "https://en.wikipedia.org/wiki/History, https://en.wikipedia.org/wiki/History_of_Macau, https://en.wikipedia.org/wiki/History_of_Malaysia <br />";
}
}
?>
</body>
</html>