简体   繁体   中英

How can i read the table name while showing tables from database php mysql

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

replace

echo "<option>$row[0]</option>";

to

echo "<option value='{$row[0]}'>{$row[0]}</option>";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM