I have read many posts like this and can not get this to work right. The box always remains empty, yet there are rows in the table. Any help would be appreciated. Thanks.


//Variables for mysql database connection

// connect to MySQL
$connection = mysql_connect(localhost, $user, $password);
if (!$connection) {
    die('Could not connect: ' . mysql_error());

$result = mysql_query ("select Name from dba.wx_faq_backup group by Name");
echo "<select name=DB_Backup value=''>Database Backup</option>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[Name]</option>";
/* Option values are added by looping through the array */
echo "</select>";// Closing of list box

mysql_free_result($result) ;

7 Years
Discussion Span
Last Post by gunderjj
$result = mysql_query ("select Name from dba.wx_faq_backup group by Name") or die (mysql_error());

echo "<select name='DB_Backup' value=''>Database Backup</option>";

    echo "<option selected value='$i' > $nt[Name] </option>"."<BR>";
echo "</select>";

Before, you were populating the value of the selection, rather than the actual selection option. You may want to put a numeric ID in the value property (signified by the $i)

Edited by nonshatter: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.