-1
這是表格形式,我將選擇該行通過按鈕編輯如何從表格行獲取值?
$query = "SELECT * FROM tbl_document LIMIT $start, $end";
$result = mysqli_query($con,$query);
echo "<table border='1' width='300' height='160' align = center id='result'>";
echo '<tr>
<th width="80">ID</th>
<th width="200">Title</th>
<th width="260">Presented To</th>
<th width="260">Presented By</th>
<th width="160">Date Submitted</th>
<th>Location</th>
<th width="17%">Option</th>
</tr>';
while($row = mysqli_fetch_array($result)){
echo "<tr align = center >";
echo "<td width='20' height='60'>" .$row['ID']. "</td>";
echo "<td width='120' height='60'>" .$row['Title']. "</td>";
echo "<td>" .$row['Presented_To']. "</td>";
echo "<td>" .$row['Presented_By']. "</td>";
echo "<td>" .$row['Date_Submitted']. "</td>";
echo "<td>" .$row['Location']. "</td>";
echo "<td width='17%'>";
?>
<p>
<button onclick="document.getElementById('edtID').style.display='block'" value="<?php echo $row['ID']; ?>" class="w3-btn w3-blue w3-border-large w3-circle" id="edit" name="edit" style="width:60%"><i class="fa fa-edit"></i> Edit</button>
這是第二次代碼這種形式是有模式的,我按一下桌上的按鈕,模式顯示,您可以編輯編輯但我的代碼缺少什麼?
<form method="post" action="<?php $_SERVER['PHP_SELF'];?>">
<p>
<label class="w3-label w3-text-black"><strong>Title:</strong></label>
<input class="w3-input w3-hover-light-blue w3-animate-input w3-border-large w3-light-grey" style="width:100%" type="text" id="title" name="title" placeholder="Title" value=<?php $row['Title']; ?>required></span>
</p>
</form>
來自表格行的值 – RiggsFolly