我想知道如何将我在数据库中获取的数据显示到表单中。无论如何这里是我的代码:
<form action="" method="POST" style="height:350px; ">
<?php while( $row = $result->fetch_assoc()){ ?>
<label>First name</label>
<input type="text" contenteditable="true" value="<?php echo $row['fname'];?>" class="fname" name="fname"/>
<label>Middle name</label>
<input type="text" contenteditable="true" value="<?php echo $row['mname'];?>" class="mname"name="mname"/>
<label>Last name</label>
<input type="text" contenteditable="true" value="<?php echo $row['lname'];?>" class="lname" name="lname"/>
<label>Gender</label>
<input type="text" contenteditable="true" value="<?php echo $row['gender'];?>" class="gender" name="gender"/>
<br><label>Birthdate</label>
<input type="text" contenteditable="true" value="<?php echo $row['bday'];?>" class="bday" name="bday"/>
<label>Civil Status</label>
<input type="text" contenteditable="true" value="<?php echo $row['cstatus'];?>" class="cstatus" name="cstatus"/>
<label>Citizenship</label>
<input type="text" contenteditable="true" value="<?php echo $row['cship'];?>" class="cship" name="cship"/>
<label>Addresss</label>
<input type="text" contenteditable="true" value="<?php echo $row['address'];?>" class="address" name="address"/>
<br><label>Contact Number</label>
<input type="text" contenteditable="true" value="<?php echo $row['cnumber'];?>" class="cnumber" name="cnumber"/>
<label>E-mail:</label>
<input type="text" contenteditable="true" value="<?php echo $row['email'];?>" class="email" name="email"/>
<label>Father's name:</label>
<input type="text" contenteditable="true" value="<?php echo $row['fathername'];?>" class="fathername" name="fathername"/>
<label>Contact number:</label>
<input type="text" contenteditable="true" value="<?php echo $row['fcontact'];?>" class="fcontact" name="fcontact"/>
<label>Mother's name:</label>
<input type="text" contenteditable="true" value="<?php echo $row['mothername'];?>" class="mothername" name="mothername"/>
<label>Contact number:</label>
<input type="text" contenteditable="true" value="<?php echo $row['mcontact'];?>" class="mcontact" name="mcontact"/>
<label>Guardian's name:</label>
<input type="text" contenteditable="true" value="<?php echo $row['gname'];?>" class="gname" name="gname"/>
<br><label>Contact Number:</label>
<input type="text" contenteditable="true" value="<?php echo $row['gcontact'];?>" class="gcontact" name="gcontact"/>
<label>Current/Last School Attended:</label>
<input type="text" contenteditable="true" value="<?php echo $row['lschool'];?>" class="lschool" name="lschool"/>
<?php
}
?>
我要做的是当我点击页面上的表格时,表单应该能够显示所点击的行的信息,但是当我的数据库上有新数据时,它只是加起来并加起来在我的表单上,而不是让点击的行汇总信息。