Re: create dropdown menu from returned $result

From: Date: Sun, 16 Nov 2003 16:37:22 +0000
Subject: Re: create dropdown menu from returned $result
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169844@lists.php.net to get a copy of this message
PAUL FERRIE wrote:
What am i overlooking?
The part where you tell us what you're actually trying to achieve...
<? 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>";
Why are you echoing data and displaying <br> between <select> and </select>... That's bad HTML.
$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'
So I see a select box with two options, 'reviews' and 'albums' that's made from badly formed HTML. What are you trying to accomplish?? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#169844) next »