Re: create dropdown menu from returned $result
| From: | Duncan | Date: | Sun, 16 Nov 2003 16:33:38 +0000 |
| Subject: | Re: create dropdown menu from returned $result | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169843@lists.php.net to get a copy of this message | ||
Currently you create 1 selectbox for each loop through the while loop (leaving aside that the <select> is in and the </select> outside the very same).
By taking a quick look at it I recommend that you put the
echo "<SELECT NAME='$tablename'>";
line outside & above the while loop.
...Hendrik
PAUL FERRIE wrote:
What am i overlooking? <? include('common.php'); $result = mysql_list_tables("***_vinrev"); $i = 0; while ($i < mysql_num_rows ($result)) { $tb_names[$i]= mysql_tablename ($result, $i); echo "<SELECT NAME='$tablename'>"; echo "<OPTION VALUE=\"".$tb_names[$i]."\">". $tb_names[$i]." </OPTION> "; echo $tb_names[$i] . "<BR>"; $i++;}echo "</SELECT>"; ?> When tested heres what i get http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/table_list.php There are 2 tables within the DB 'reviews', 'albums' Cheers Paul