How to select all table names from a database and show them in select option(or dropdown list) using php and msqli.
$db_selected = mysqli_select_db($data,$sub);
if(!$db_selected)
{
die ("Can\'t use : ".$sub . mysqli_error($data));
}
$result = mysqli_query( $data,"show tables"); ?>
<form action="checkanswers.php" method="post">
<select class="form-select" aria-label="Default select example"
name="sell">
<option selected>Please select a subject.</option>
<?php
while($row = mysqli_fetch_assoc($result)) {
$table=$row[$sub];
?>
<option>
<?php echo "$table" ?> </option>
<?php }?>
</select>
<button type="submit" class="btn btn-primary" title="Check
Answer">Check Answer</button>
</form>