![](/img/trans.png)
[英]How to get the value of html <input type=“hidden”> in PHP?
[英]How to get the hidden value for the input stored in php
我写了一个php文件p1
创建了一个表单,通过使用<?php>
标签将值存储到字段中,而我试图使用文件delete_product.php
来获取输入,为什么当我回显变量时,什么都没有出现?
P1:
require('database.php');
$query = 'select * from products';
$stmt = $db->prepare($query);
$stmt->bind_result($productCode, $name, $version, $releaseDate);
$stmt->execute();
<table border="1px solid black" border-collapse="collapse">';
echo'<tr><th>Code</th> <th>Name</th> <th>Version</th> <th>Release Date</th> <th> </th></tr>';
while($stmt->fetch()) {
echo"<tr> <td>$productCode</td> <td>$name</td> <td>$version</td> <td>$releaseDate</td>
<td><form action=\"delete_product.php\" method=\"post\">
<input type=\"hidden\" value=\"$productCode\" name=\"code\">
<input type=\"submit\" value=\"Delete\">
</form></td></tr>";
delete_product.php:
<?php
$product_code = filter_input(INPUT_POST, "code");
echo $product_code;
?>
请使用firebug检查隐藏的输入字段是否包含值。 如果此显示为null,请检入您的记录。 如果它包含值,则按删除按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.