如何在php中将数据库中的数据显示为文本

时间:2016-12-16 11:53:14

标签: javascript php mysql html5

当我按下选择按钮时,我想将数据库中的数据显示到文本框中,但我坚持下去,我接下来要做什么,在此先感谢

BootStrapCode

<td><label class="control-label" for="finame" id="myID1" >FIRST NAME</label></td>
<td><input type="text" class=" form-control2 input-sm text-uppercase"name="firstname" onkeypress="return allCharacter(event);" ></td>
<td><label  class="control-label" for="mname">MIDDLE NAME</label></td>
<td><input type="text" class=" form-control2 input-sm text-uppercase" name="middlename"></td>
<td><label  class="control-label" for="lname" id="myID2">LAST NAME</label></td>
<td><input type="text" class="  form-control2 input-sm text-uppercase" name="lastname" onkeypress="return allCharacter(event);"></td>

php代码

if (isset($_POST['select_button'])) {
  $qrydatabind1 = 'SELECT ecode, first_name, middle_name, last_name, father_name, mother_name,
              number_of_dependents, dob, gender, identification_mark, marital_status, spouse_name, mobile_number,
              email_id, adhar_id, pan_number, passport_number, tin_number, dl_number FROM USER_MASTER';
  $results1 = mysql_query($qrydatabind1) or die(mysql_error());

  while ($row = mysql_fetch_array($results1)) {
    echo '<td><input  type="text" value="{$row["first_name"]}" ></td>';
  }
}

1 个答案:

答案 0 :(得分:1)

代码中存在错误。将while循环更改为此循环:

.pydistutils.cfg