diff --git a/webui/user-attributes.php b/webui/user-attributes.php
index 6ff1f9af4c4070e97f00a74e1667b4f06e6c5e76..7d947be3e875da51a06c26957464a0798efedfc1 100644
--- a/webui/user-attributes.php
+++ b/webui/user-attributes.php
@@ -75,37 +75,49 @@ printHeader(array(
 		</tr>
 <?php
 	$_SESSION['attr_user_id'] = $_POST['user_id']; 
-	if (isset($_SESSION['attr_user_id'])) {
+	if (isset($_POST['user_id'])) {
 
 		$temp = $_SESSION['attr_user_id'];
 		$sql = "SELECT ID, Name, Operator, Value, Disabled FROM ${DB_TABLE_PREFIX}user_attributes WHERE UserID = $temp ORDER BY ID";
 		$res = $db->query($sql);
 
-		if ($res) {
-			while ($row = $res->fetchObject()) {
+		$rownums = 0;
+		while ($row = $res->fetchObject()) {
+			if ($row->id != NULL) {
+				$rownums = $rownums + 1;
+			} else {
+				$rownums = $rownums - 1;
+			}
 ?>
-				<tr class="resultsitem">
-					<td><input type="radio" name="attr_id" value="<?php echo $row->id ?>"/><?php echo $row->id ?></td>
-					<td><?php echo $row->name ?></td>
-					<td><?php echo $row->operator ?></td>
-					<td><?php echo $row->value ?></td>
-					<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
-				</tr>
+			<tr class="resultsitem">
+				<td><input type="radio" name="attr_id" value="<?php echo $row->id ?>"/><?php echo $row->id ?></td>
+				<td><?php echo $row->name ?></td>
+				<td><?php echo $row->operator ?></td>
+				<td><?php echo $row->value ?></td>
+				<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
+			</tr>
 <?php
-			}
-		$res->closeCursor();
 		}
+		$res->closeCursor();
+		if ($rownums <= 0) {
 ?>
-	</table>
-</form>
+			<p />
+			<tr>
+				<td colspan="5" class="textcenter">Group attribute list is empty</td>
+			</tr>
 <?php
-} else {
+		}
+		unset($rownums);
+	} else {
 ?>
-	<div class="warning">Invocation error, no user ID selected</div>
+		<tr class="resultitem">
+			<td colspan="5" class="textcenter">No User ID selected</td>
+		</tr>
 <?php
-}
-
+	}
 ?>
+	</table>
+</form>
 <?php
 
 printFooter();