Reply to Re: [PHP] Is there a way to display data from database for Select Options in a form?

Your name:

Reply:


Posted by Jochem Maas on 01/10/06 18:37

teaching noobs to output html while (oun intended) looping thru a
result set is counter-productive. discuss.

Adrian Bruce wrote:
> Something along these lines will work fine
>
> <?php
> $query = mysql_query("select dates from table ") or die (mysql_error());
>
> echo"<select name='test'>";
>
> while ($row = mysql_fetch_array($query, MYSQL_NUM)){
> echo"<option value='$row[0]'>$row[1]</option>";
>
> }
> echo"</select>";
> ?>
>
> Regards
> Ade
>
> Sue wrote:
>
>> Hello,
>>
>> We have a form that contains a Select option for a listing of
>> available dates for the user to choose from. Right now we have to
>> manually change the dates within the form's Selection list as new
>> dates become available to choose from. We currently store these
>> available dates in our database, and am wondering if we can somehow
>> extract these dates from the table to display in our form? This would
>> eliminate alot of maintenance needed to this form. If anyone has any
>> ideas as to reference material etc. that I may look which would give
>> me an idea how to do this using PHP, I'd appreciate it!
>>
>> Thanks!
>> Sue
>>
>>
>

[Back to original 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

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