Re: Re: dynamic combo boxes

From: Date: Tue, 01 Oct 2002 21:17:35 +0000
Subject: Re: Re: dynamic combo boxes
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-16107@lists.php.net to get a copy of this message
The line
    echo "<br>";
has no effect except filling space in the file... To get a value try echo "<option value='$optionval'>$optionval</option>"; Cheers... Luis Ferro Tim Blackwell wrote:
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
--- [This E-mail scanned for viruses by Declude Virus]

« previous php.windows (#16107) next »