Question regarding Cookies
Posted: Sat Nov 14, 2009 7:40 am
I would like to add selected elements from a form containing radio buttons to a cookie.
So like if I have 2 options: Vertical, Horizontal and the user selects Horizontal i want horizontal to become the value of the cookie.
Right now this is what I have:
Above the html tag:
In the body:
How would I do this?
So like if I have 2 options: Vertical, Horizontal and the user selects Horizontal i want horizontal to become the value of the cookie.
Right now this is what I have:
Above the html tag:
Code: Select all
<?php
$attendance_yes = 'unchecked';
$attendance_no = 'unchecked';
if (isset($_POST['submit'])) {
$selected_radiobtn = $_POST['guest_attendance'];
(setcookie("TestCookie",$selected_radiobtn,time()+3600)){
}
?>Code: Select all
<?php
echo "<br /><br /><br /><br /><center>";
echo "<h3>Click the buttons on one of the options below and an example will show up below me!</h3>";
echo "<iframe src=\"menus.php\" name=\"test\" width=\"700px;\" height=\"280px\" frameborder=\"0\" scrolling=\"no\">" ;
echo "</iframe>";
echo "<form name=\"menus\" id=\"menus\" method=\"post\" action=" . $PHP_SELF . "\">";
echo "<br /><br /><input type=\"radio\" name=\"Menu\" value=\"Vertical\" onclick=\"test.location.href='menus/vertical/cssmenu.html'\" />Vertical";
echo "<input type=\"radio\" name=\"Menu\" value=\"horizontal\" title=\"Horizontal\" onclick=\"test.location.href='menus/horizontal/cssmenu.html'\">Horizontal<br />";
echo "<input type=\"submit\" name=\"submit\" value=\"next\" />";
echo "</form></center>";
?>