php - For loop with column titles -


is there anyway can make code have loop creates actual select box each column title?

i have forloop in place information in database not column titles

</select><br>     <label for="fo">footrest options: </label>     <select name="fo">     <option>----</option>     <?     foreach ($liftsecond $lift){ echo '<option>'.$lift["footrest options"].'</option>';  } ?> </select><br>   <label for="sw">seat width:  </label>     <select name="sw">     <option>----</option>     <?     foreach ($liftsecond $lift){ echo '<option>'.$lift["seat width"].'</option>';  } ?> </select><br>   <label for="ss">seat style:  </label>     <select name="ss">     <option>----</option>     <?     foreach ($liftsecond $lift){ echo '<option>'.$lift["seat style"].'</option>';  } ?> </select><br> 

for instance, have:

<select name="fo"> <option>----</option> 

is there way of querying database retrieve column names , loop through them , create select boxes necessary?

thanks

query column name of table:

    <select name="fo">     <option>----</option>     <?php          $sql = "show columns your-table";             $result = mysqli_query($conn,$sql);             while($row = mysqli_fetch_array($result)){             echo "<option>".$row['field']."</option>";             } ?>  </select> 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -