首先不应该再次以HTML格式存储细节,因为您可以随时创建。
如果您想这样做,您可以创建一个变量并将渲染HTML存储在该变量中,您可以打印相同的变量并将该变量保留在隐藏字段中。
提交带有发布请求的表单,因为可能隐藏字段值的隐藏大小会更大。
如果隐藏字段的大小多于只发送记录的主键到服务器端再从数据库中获取详细信息创建相同的HTML并将其存储回另一个表。
下面是在变量中存储HTML并显示它的代码。您可以创建表单并提交上面提到的值。
include('ApprovalDB.php');
$result = mysql_query("SELECT pr_id, prcode, type, client, requestdate, status FROM t_purchaserequest where status = 'Approved' and type = 'Sample Only'")
or die(mysql_error());
$str = "";
$str .= "
$str .= "PRCODETYPE CLIENT REQUESTED DATE STATUSACTION";
while ($row = mysql_fetch_array($result)) {
$str .= "
";$str .= '
' . $row['prcode'] . '';$str .= '
' . $row['type'] . '';$str .= '
' . $row['client'] . '';$str .= '
' . $row['requestdate'] . '';$str .= '
' . $row['status'] . '';$str .= "
";}
$str . "
";//display the data
echo $str;
//to save the data ideally you should not save in this format but still you want to do you can do in two way
//1. most appropriate way you can get the product details in server side, create same string like i have created above and save it to db
//2.create hidden field and save the data with post form
echo "";
?>