我需要在每个链接上创建包含不同名称的隐藏输入的链接。
<?php
$inputCounter=0;
.. do while...
{
$inputCounter++; ?>
<a href="read.php">
<input hidden name="rec<?php echo $inputCounter ;?>"
value="<?php echo $id' ;?>"/>
read
</a>
<?php } ?>
如何获取read.php中的输入值? 感谢您的任何帮助。
答案 0 :(得分:2)
不要在锚标记中放置输入。使用查询字符串传递值。
<a href="read.php?name=rec<?=$inputCounter?>&value=<?=$id?>">read</a>
然后在read.php
上,使用$_GET
读取您的数据。
$name = $_GET['name'] // gives you the name
$value = $_GET['value'] // gives you the value
要回显该值,只需执行
echo $value;