handled another potential xhtml error: empty select when no members in group.

This commit is contained in:
nicolasconnault
2007-03-30 06:28:31 +00:00
parent 60b6fc1004
commit b608d7cad3
+6 -3
View File
@@ -323,9 +323,12 @@ if ($success) {
if (isset($userids)) { //&& is_array($userids)
// Put the groupings into a hash and sort them
$user_names = groups_userids_to_user_names($userids, $courseid);
foreach ($user_names as $user) {
echo "<option value=\"{$user->id}\">{$user->name}</option>\n";
if(empty($user_names)) {
echo '<option>&nbsp;</option>';
} else {
foreach ($user_names as $user) {
echo "<option value=\"{$user->id}\">{$user->name}</option>\n";
}
}
} else {
// Print an empty option to avoid the XHTML error of having an empty select element