Reputation: 31
Hi Am trying to read the table name from the dropdown but am unable give the name option name. Here is my code.
<div class="form-group">
<label class="control-label col-sm-2" for="email">Enter number of titles:</label>
<div class="col-sm-10">
<select>
<?php
include 'config.php';
$query="show tables";
$result_query=mysqli_query($conn,$query);
while($row=mysqli_fetch_array($result_query))
{
echo "<option>$row[0]</option>";
}
?>
</select>
</div>
</div>
How can I give the option value or name as there are 10 tables I need to read the table name once the table is selected
Thank you
Upvotes: 0
Views: 49
Reputation: 109
replace
echo "<option>$row[0]</option>";
to
echo "<option value='{$row[0]}'>{$row[0]}</option>";
Upvotes: 1