Checkboxes
Posted: Tue Oct 03, 2006 10:41 am
Ok, I am generating checkboxes from entries I have in a database.. I can do this just fine. What I am stuck on is how do it tell if a user has checked that specific box in my other php files? I can't use $_Post[] can I? The reason that I assume that is because the id is always going to be different. It will always be the index of a date range from my database.
I orginally had a drop down populated with all the date ranges and that was fine since I could just see what the value of that box was in my other scripts... but being able to select more than one range would be a plus...
Here is the code I use to generate the checkboxes:
Thanks for any thoughts
I orginally had a drop down populated with all the date ranges and that was fine since I could just see what the value of that box was in my other scripts... but being able to select more than one range would be a plus...
Here is the code I use to generate the checkboxes:
Code: Select all
$db = "calendar";
mysql_select_db($db) or die("Couldn't open DB: " .mysql_error());
$query = "select num, DATE_FORMAT(startDate,'%M %e, %Y') as startDate, DATE_FORMAT(endDate, '%M %e, %Y') as endDate from extendedDates";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
$p = "<ul>";
while($d = mysql_fetch_array($result))
{
$id = $d['num'];
$sdate = $d['startDate'];
$edate = $d['endDate'];
$p .= "<li><input name = ". $id . " type = \"checkbox\" id=" . $id . "/> $sdate - $edate </label>";
}
$p .= "</ul>";
echo $p;