Re: dynamic combo boxes

From: Date: Tue, 01 Oct 2002 20:13:52 +0000
Subject: Re: dynamic combo boxes
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-16106@lists.php.net to get a copy of this message
okay, i figured out the combo thing--code is below. it actually wasn't too difficult with some help! but, when i use tutname i get an undefined variable it works fine with the static combo that i was using? can you think of any reason for this? function load_combobox() { ?> <? @ $db = mysql_pconnect("localhost", "", ""); if (!$db) { echo "Error: Could not connect to database. Please try again later."; exit; } mysql_select_db("tutorial"); $options = "select distinct tutorialname from tutorial"; $optres = mysql_query($options); $opt_results = mysql_num_rows($optres); echo "<select name=tutname>"; for ($i=0; $i <$opt_results; $i++) { $optrow = mysql_fetch_array($optres); $optionval = stripslashes($optrow["tutorialname"]); echo "<option>$optionval</option>"; echo "<br>"; } echo "</select>"; ?> <? } tim "Tim Blackwell" <timblackwell@hotmail.com> wrote in message news:20020930210133.8245.qmail@pb1.pair.com... > hi--i'm having some trouble autoloading a combo box with a mysql column. > could someone help please > > thanks, > > tim > >

« previous php.windows (#16106) next »