.Hi everyone i need a little help for my dropdown menu.
.I already know how to populate a dropdown list from a database but what i want to do is to fill my dropdown list with the list of databases available in my MySQL server. can anyone please help me with the proper coding for this one. Thanks in advance! by the way i am using php.
update:
.alright i tried this:
$sql = "SHOW databases";
$result = mysql_query($sql);
echo '<form method="post" id="try" action="pillar.php">';
echo '<select name="batch" id="batch">';
echo '<option>';
while($r = mysql_fetch_assoc($result))
{
$database = $r['Database'];
echo '<option>'.$database.'</option>';
}
echo '</select><br>';
echo '<input type="submit">';
echo '</form>';
IT works! but is there a way that i could exclude any of the retrieved values? because what i want to output on my dropdown is the list of batch which is the databases. but what happens is that the dropdown includes the default databases of MySQL. like “information_schema” and “mysql”.
(I don’t want to many FALSE operators in a single if clause, hence the action in else)