[英]get dynamic input value with php
i need to create links containing hidden input with different names on each links. 我需要创建包含每个链接上不同名称的隐藏输入的链接。
<?php
$inputCounter=0;
.. do while...
{
$inputCounter++; ?>
<a href="read.php">
<input hidden name="rec<?php echo $inputCounter ;?>"
value="<?php echo $id' ;?>"/>
read
</a>
<?php } ?>
how to get the input value in read.php ? 如何获取read.php中的输入值? thank you for any help. 感谢您的任何帮助。
Do not place an input in an anchor tag. 不要将输入放置在锚标记中。 Use query string to pass values along. 使用查询字符串来传递值。
<a href="read.php?name=rec<?=$inputCounter?>&value=<?=$id?>">read</a>
Then on read.php
, read your data using $_GET
. 然后在read.php
,使用$_GET
读取数据。
$name = $_GET['name'] // gives you the name
$value = $_GET['value'] // gives you the value
To echo the value, just do 要回显值,只需执行
echo $value;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.