|
Posted by Rik on 01/18/07 11:16
Geert-Jan van Leeuwen wrote:
> I am using the html <select>-<option> code to select options i read
> from mysql:
>
> echo "<select name=status> ";
>
> $query = veilige_query("
> select id, status
> from status
> order by id
> ");
> while ($regel = mysql_fetch_array ($query))
> {
> echo "<option value=" . $regel["status"] . ">" .
> $regel["status"];
> }
> echo "</select>";
>
>
>
> If in an option there are spaces it only returns the part until the
> space. For example:
> The mysql table has a value "In public". On the html-page I see "In
> public", the returned result is: "In". So it skipped everything after
> the space. When I read values using
> <input type=text name=so-and-so>
> it reads everything allright.
>
> I am missing something in php. What am i doing wrong?
This had nothing to do with PHP, it has to do with valid HTML.
Look at HTML source you ouput: you should always quote the value in an
option (actually, you should quote _all_ attribute values).
--
Rik Wasmus
Navigation:
[Reply to this message]
|