You are here: Re: php skips spaces « All PHP « IT news, forums, messages
Re: php skips spaces

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация