看了一堆例子。没发生什么事。我尝试转移到输入元素的ID 的值。数据库中用于后续删除记录的行标识符。但无论我如何尝试,Get 都不会从 id 属性中获取此值<?php require_once("dbcontroller.php"); $db_handle = new DBController(); $sql = "SELECT * from main"; $faq = $db_handle->runQuery($sql);?><table class="one"> <thead> <tr> <th class="table-header" width="10%">№</th> <th class="table-header">Дата</th> <th class="table-header">Адрес</th> <th class="table-header" width="10%">Наименование проекта</th> <th class="table-header">Что изменено</th> <th class="table-header">Кем</th> <th class="table-header">Документ</th> </tr> </thead> <tbody> <?php foreach($faq as $k=>$v) { ?> <tr class="table-row"> <td><?php echo $k+1; ?></td> <td contenteditable="true" onBlur="saveToDatabase(this,'destination','<?php echo $faq[$k]["id"]; ?>')" onClick="showEdit(this);"><?php echo $faq[$k]["destination"]; ?></td> <td contenteditable="true" onBlur="saveToDatabase(this,'name_change','<?php echo $faq[$k]["id"]; ?>')" onClick="showEdit(this);"><?php echo $faq[$k]["name_change"]; ?></td> <td contenteditable="true" onBlur="saveToDatabase(this,'changee','<?php echo $faq[$k]["id"]; ?>')" onClick="showEdit(this);"><?php echo $faq[$k]["changee"]; ?></td> <td contenteditable="true" onBlur="saveToDatabase(this,'date_change','<?php echo $faq[$k]["id"]; ?>')" onClick="showEdit(this);"><?php echo $faq[$k]["date_change"]; ?></td> <td contenteditable="true" onBlur="saveToDatabase(this,'moderator','<?php echo $faq[$k]["id"]; ?>')" onClick="showEdit(this);"><?php echo $faq[$k]["moderator"]; ?></td>
1 回答
心有法竹
TA贡献1866条经验 获得超5个赞
只需将 id 传递给 url :
// Notice this ---------------------------------------------------------------------v-------------------------------v
<input type="submit" name="delete" value="Delete" onclick="location.href='delete.php?id=<?php echo $faq[$k]["id"]; ?>'" id='<?php echo $faq[$k]["id"]; ?>'>
请注意,您在 中放置了过多的单引号id=''<?php echo $faq[$k]["id"]; ?>'',我在示例中删除了它们
- 1 回答
- 0 关注
- 194 浏览
添加回答
举报
0/150
提交
取消