members.php and pull down menu
Permalink
Hello all! Irecently modified my members.php and controller.php with theese codes
members.php:
<?php
$db = Loader::db();
$query = "SELECT gID, gName FROM Groups";
$result = $db->Execute($query);?>
<select name="group">
<option value=""></option>
<?php
while($row=$result->fetchRow()) {
$gID = $row['gID'];
$gName = $row['gName'];
?><option value="<?php echo $gID?>"><?php echo $gName?></option><?php
}
?>
</select>
and controller.php replaced:
$keywords = $this->get('keywords');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
With
$keywords = $this->get('keywords');
$groupID = $this->get('group');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
if ($groupID != '') {
$userList->filterByGroup($groupID);
}
Now that gives me a pull down menu to filter by group. What i wabt to do is populate my pulldown menu with all the groups but one "membersprivate" would someone be kind anough to explain me how to acheive that?
Thank you in advance
Mike.
members.php:
<?php
$db = Loader::db();
$query = "SELECT gID, gName FROM Groups";
$result = $db->Execute($query);?>
<select name="group">
<option value=""></option>
<?php
while($row=$result->fetchRow()) {
$gID = $row['gID'];
$gName = $row['gName'];
?><option value="<?php echo $gID?>"><?php echo $gName?></option><?php
}
?>
</select>
and controller.php replaced:
$keywords = $this->get('keywords');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
With
$keywords = $this->get('keywords');
$groupID = $this->get('group');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
if ($groupID != '') {
$userList->filterByGroup($groupID);
}
Now that gives me a pull down menu to filter by group. What i wabt to do is populate my pulldown menu with all the groups but one "membersprivate" would someone be kind anough to explain me how to acheive that?
Thank you in advance
Mike.
Could you please use [code] tags and what do you mean:
"populate my pulldown menu with all the groups but one "membersprivate""
Mike