简体   繁体   English

无法更新php中的动态表格

[英]Unable to update the Dynamic form table in php

Generating a dynamic table from mysql Database and trying to update each row. 从mysql数据库生成动态表并尝试更新每一行。

Snippet of dynamic table which was generated: 生成的动态表的代码段:

echo "<form id='contact' action='update.php' method='post'>";
echo "<table class='responstable'>";
while( $row = $query->fetch_assoc())
{ 
 $d=$row['Testcaseid'];
 $a=$row['Assignee'];
 $testcasename=$row['Testcasename'];
 $status=$row['Status'];
 $defectid=$row['Defect ID'];
 $executeddate=$row['Executed Date'];
 echo "<tr>";
 echo "<td><input  type='checkbox' value=$d></td>";
 echo "<td>$d</td><td name='Testcasename'>$testcasename</td>";
 echo "<td><input type='text' name='status' value='$status'>";
 echo "<td><input type='text'  name='assignee' style='width:125px;' 
 value=$a></input></td>";
 echo "<td><input name='defectid' value='$defectid'></input></td>";
 echo "<td><button type='Submit' name='submit' value='$d'>Update</button>
 </td>";
 echo "</tr>";
 }
echo "</table>";

The Update php Code: 更新php代码:

 $Assignee = $_POST["assignee"];
 $Testcaseid= $_POST["submit"];
 $status=$_POST["status"];
 $defectid=$_POST["defectid"];
 $submit=$_POST["submit"];
 $date = date('Y-m-d H:i:s');

The updated value given by the user is not getting saved in the new variable in update, rather the value present in the db is getting stored. 用户给出的更新值不会在update中保存在新变量中,而是存储在db中。

How to bring the user edit value in update.php? 如何在update.php中为用户带来编辑值?

在while循环内给出表单后,问题得到解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM