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.

<?php

//Variables for mysql database connection
$user='testuser';
$password='testpass';

// 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) ;

?>
$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>";

$i=1;
while($nt=mysql_fetch_assoc($result))
{
    echo "<option selected value='$i' > $nt[Name] </option>"."<BR>";
    $i++;
}
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)

Thanks, fixed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.