I need help with the proper code to retrieve a variable from a dropdown list array in a form and parse the data on another page.
Here I use a while loop to create a dropdown list of databases in MySql....
$db_select = "<td><select name=\"select_db[]\">";
$connection = mysql_connect("localhost", "root", "") or die("Couldn't connect.");
$dbs = mysql_list_dbs($connection) or die("Couldn't list databases.");
$i=0;
while ($i < mysql_num_rows($dbs)) {
$db_names[$i] = mysql_tablename($dbs, $i);
$db_select .= "<option name=\"$db_name\" value=\"$db_name\">$db_names[$i]</option>";
$i ++;
}
$db_select .= "</select></td>";
Then for example I use a form to post the data to another script that will delete the selected databes....
if($action == "delete") {
$connection = mysql_connect("localhost","root","") or die("couldn't connect");
$result = mysql_drop_db("$db_name", $connection) or die("couldn't delete database");
if($result) {
$msg = "Database has been deleted";
It seems as this code is sending an empty value for $db_name which causes an error when the php attempts to delete the database. Can anyone provide help with proper syntax for this procedure? TIA
Kyler