Why is this not working??
How this works is it retrieves a set of note heads and concatenates them onto currentHeads variable. I them create the prespecified array of general note heads. I want to check the presepcified note heads against the currentHeads and exclude the already specified heads from the drop down box so then cannot be added again.
What is happening is when the results are returned with items that are located in the preSpecArr they still show up within the drop down box. However, it is the only items that contain the generated date.
$getNoteHead = mysql_query("SELECT id_nbnote1,note_head FROM nbnote1 WHERE id_nbglobal = '$globalID'");
$numRecs = mysql_num_rows($getNoteHead);
// Build the list of current client/agent note heads
for( $x=0; $x < $numRecs; $x++ ) {
$row = mysql_fetch_array($getNoteHead);
if( empty($currentHeads) )
$currentHeads = $row[note_head];
else
$currentHeads .= $row[note_head];
}
// Set the date and preSpecArr
$date = date("m-d-Y");
$preSpecArr = array( "Additional EE","General Claims Issue","Claims Issue ($date)","General Commission Issue","Commission Issue ($date)","Enrollment","Renewal" );
// Start select tag
$tag = "<select name=\"preSpecNoteHead\" id=\"select\" style=\"font-size: 12px;\">";
$tag .= "<option selected></option>";
for( $x=0; $x < count($preSpecArr); $x++ ) {
if( !preg_match( "/$preSpecArr[$x]/i",$currentHeads ) ) {
// Add each note head to list form preSpecArr -> Array of predetermined note heads
$tag .= "<option value=\"$preSpecArr[$x]\"";
$tag .= ">$preSpecArr[$x]</option>";
}
}
// Close the tag
$tag .= "</select>";
// Send tag back to caller
return $tag;