Page 1 of 1

List Box has a space between each value please help

Posted: Thu Jun 15, 2006 2:22 pm
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

Posted: Thu Jun 15, 2006 2:42 pm
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.