[英]Passing a user-entered input value to another php page
I have an input box in index.php which takes some user input and queries a database using that input field as an attribute. 我在index.php中有一个输入框,它接受一些用户输入并使用该输入字段作为属性查询数据库。 This input is stored in $arrInput[0].
此输入存储在$ arrInput [0]中。
I also have a link to inspect.php which, when clicked, takes me to inspect.php but I need to pass $resultArr[0] to inspect.php so that I can use that variable to continue doing other things within inspect.php. 我还有一个指向inspect.php的链接,当点击它时,我会把我带到inspect.php,但我需要将$ resultArr [0]传递给inspect.php,以便我可以使用该变量继续在inspect.php中做其他事情。 。 How can I achieve this?
我怎样才能做到这一点? \\
\\
Currently this is what I have: 目前这就是我所拥有的:
/* inspect.php */
// Create a table with some rows. Then create this
// column which has the inspect link
echo "<td> <a href='inspect.php?id=<?php echo $resultArr[0]; ?>'>Inspect</a>
</td>";
...
But I don't know how to access $resultArr[0] within inspect.php. 但我不知道如何在inspect.php中访问$ resultArr [0]。 I was told $_GET[] would help, but I'm not sure how and googling the subject hasn't been much help.
我被告知$ _GET []会有所帮助,但我不确定该主题是如何和谷歌搜索没有太多帮助。
Can anyone please help? 有人可以帮忙吗?
Thank you 谢谢
Not that hard. 没那么难。 use
$_GET['id']
. 使用
$_GET['id']
。
echo "<td><a href='inspect.php?id=".$resultArr[0]."'>Inspect</a></td>";
I think you are using wrong syntax. 我认为你使用了错误的语法。 Please check above code.
请检查上面的代码。 You can the access 'id' key inside $_GET.
你可以在$ _GET里面访问'id'键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.