Hello friends,

I have a php page that displays data from a mysql DB. Fields are

1. Username
2. Designation

I want to list usernames in a listbox. I know thats not a tough job but I want to give different colors (or background color) to usernames with different designation.

ie. All usernames with designation "Teamleader" should have same color and "Manager" should have different color.

Can someone help me?...

echo "<option value=".$rows['username'].">".$rows['username']."</option>";

If $rows is "Teamleader" then the font color of $rows should set to blue color.

If $rows is "Manager" then the font color of $rows should set to red color.

I just want to highlight username in listbox according to respective designation.

Try this code.

	$style = '';
		$style = 'style="color:#0000FF;"';
		$style = 'style="color:#cc0000;"';
echo "<option value=".$rows['username']." ".$style.">".$rows['username']."</option>";

Thanks "vibhadevit". It works perfect!..