从表中选择单个值到while循环中的字段

时间:2016-06-09 04:39:23

标签: php html mysql

我有一个select选项,可以使用while循环

从表中获取数据
$select_material_code = "SELECT material FROM tbl_material";
$get_material_code = mysqli_query ($con, $select_material_code);
$options_material_Code = "--Select material Code--";
while ($result_material_code = mysqli_fetch_array($get_material_code))
{
    $options_material_Code = $options_material_Code."<option>$result_material_code[0]</option>";    
}

所有数据都按预期进入列表,因此,我想继续从选择选项中选择数据并将值提取到下一个文本框中,但我无法得到它。 请帮帮....

1 个答案:

答案 0 :(得分:0)

$select_material_code = "SELECT material FROM tbl_material";
$get_material_code = mysqli_query ($con, $select_material_code);
$options_material_Code = "--Select material Code--";
while ($result_material_code = mysqli_fetch_array($get_material_code))
  {
     $options_material_Code =
      $result_material_Code."<option>$result_material_code[0]</option>";    
  }