Posted by mars on 09/19/05 17:52
max probably wrote the following stuff on 19/09/2005 1.04:
> Hi! I'm having a problem with a very simple drop-down list since the
> page comes out with no elements in the drop-down but giving no errors.
> This is the code:
>
>
> <form name="year_search_form" method="post" action="results.php">
> <select name="select_year" id="select_year">
> <?
> $query="SELECT * FROM table ORDER BY year";
> $result = mysql_query($query) or die ("Error in query: $query. "
> .mysql_error());
>
> while ($line = mysql_fetch_array($result)) {
> print ("<OPTION value=".$line['year']."></OPTION>"); }
> ?>
> </select>
> </form>
>
> The connection with the DB is established and working..
> Thanks for your help!!
Fixed it! The main problem were the quotes :
print ('<OPTION value="'.$line['year'].'">'.$line['year'].'</OPTION>');
here it works.
Thanks!
[Back to original message]
|