You are here: Re: post of fetched value fails « PHP Programming Language « IT news, forums, messages
Re: post of fetched value fails

Posted by Erwin Moller on 10/06/06 08:57

rukkie wrote:

> I have a MySql db, in which I search for values to populate a selection
> box, as follows :
>
> <select size="1" name="customer">
> <option selected="selected">(not queried)</option>

Hi Rukkie,

That is wrong.
selected="selected" in nonsense.

If you want to select an option in a selectbox, you only use the word
SELECTED, and don't give it a value.

You'll have to produces something like this:
<SELECT name="customer">
<OPTION value="bla1">bla1
<OPTION value="bla2" SELECTED>bla2
<OPTION value="bla3">bla3
</SELECT>

In your code none of the options have a value.

I would advise you to FIRST learn how HTML and FORMS works, then start PHP.

Regards,
Erwin Moller


> <?php while($nt=mysql_fetch_array($result2)){
> echo "<option value=$nt[customer]>$nt[customer]</option>\n";}
> ?>
> </select>
>
> This works fine, all the customers appear with their complete names,
> including spaces if there are.
>
> When I do a submit of the php page containing this part of code and in
> this page I do a
>
> $customer=$_POST['customer'];
>
> then the value of $customer is cutted to the first <blank> (space)
> encountered.
>
> E,g, : if in the selection box the customer name John Smith appears,
> then I get in the result page after the submission as customer=John
>
> When I make a selection box, with fixed populated values (so values not
> fetched from the db) then after the submission, I get the correct info
> (values are not cutted to the first space).
>
> Is there anybody out there that can give a solution for this strange
> (to me) behaviour ? It would be uttermost appreciated !

 

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

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