使用组合框从数据库中检索数据?

时间:2013-10-08 07:38:24

标签: php

你们可以给我一些样本,在哪里使用组合框检索数据库中的数据并在PHP中填充复选框或表格。任何答案将不胜感激。 THX:)

<select id="fdtitle" name="fdtitle" value="">; 
 <option value="">Select...</option> 
 <?php   global $wpdb; 
   $table_name = $wpdb->prefix . "title";    
   $title_name = $wpdb->get_results( "SELECT id, title FROM $table_name; "); 
   foreach ( $title_name as $title ) { $titlename = $title->title; 
   echo '<option value="'.$title->id .'" >' .$titlename .'</option>'; } ?>   
</select>

1 个答案:

答案 0 :(得分:1)