Okay, here's the situation. I have a system where users log in and are able to click dates on a calendar to indicate availability to work. They click on dates NOT available. This info is stored in a table "availability" which has the fields:
availability_id
user_id (which comes from the id given them when they create an account)
date (yyyy-mm-dd)
In another section of the site, I have a setup where an assignor logs in and, via a drop down menu which displays names, choosed individuals to assign for each open slot. The code for the drop downs is currently pulling the list of names from the table where user registration info is stored "reflist" in the form of id#'s.
What I need to do, is modify the code so that it will display the user id's UNLESS they indicated they are unavailable on that date. What would I need to add and where to make that work?? I have tried several different things and can't get it even close.
Please help!
The code for the drop downs is as follows:
// get referee select
function getRefereeSelect($referees,$selname,$selected,$id,$name) {
$retVal = "<select name=\"$selname\" onChange=\"checksel($id,'$name')\">\n";
$selected = (is_numeric($selected) && isset($referees[$selected])) ? $selected : 0;
foreach ($referees as $key => $referee) {
$sel = ($key == $selected) ? " selected" : "";
$retVal .= "<option value=\"$key\"$sel>$referee</option>\n";
}
$retVal .= "</select>\n";
return $retVal;
}
// get referee array
function getReferees($conn) {
$retVal[0] = "";
$sql = "SELECT id,f_name,l_name FROM reflist ORDER BY l_name";
$res = @mysql_query($sql,$conn) or die("SQL error (referees): ".mysql_error());
while ($row = mysql_fetch_assoc($res)) {
$retVal[$row['id']] = $row['l_name'].", ".$row['f_name'];
}
return $retVal;
}