List Box has a space between each value please help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

List Box has a space between each value please help

Post by reecec »

Hi

i hope someone knows why


Code: Select all

$query = "SELECT username FROM registered_members";
   $result = mysql_query($query);
    print "<SELECT name=item>";
   while ($line = mysql_fetch_array($result))
   {
      foreach ($line as $value)
       {
         print "<OPTION value='$value'"; }  print ">$value</OPTION>";   }
print "</SELECT>";
?>

This gives a listbox with my sql values like this eg




with

a

space

in between

i get spaces in between each value and it when you go over it it highlights so it

thanks reece
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Look at the source it generates. You should notice an error in how it's output. When you find it, look at how you've ordered the commands.
Post Reply