[英]PHP Pass variable through URL using ?object=value
I know there's a bunch of these topics out there, but all the answers are simply not working for me. 我知道有很多这样的话题,但是所有的答案对我都不起作用。 I've tried everything I could find, and I'm still right where I started.
我已经尽了一切所能,但我仍然是我的起点。 I'm trying to pass a variable through a URL:
我正在尝试通过URL传递变量:
<a href="test2.php?one="<?php echo $_GET['one']; ?>">link</a>
When clicking on the "link", it redirects me to the appropriate page (test2.php), but leaves the value blank (resulting in localhost/test2.php?one=). 单击“链接”时,它会将我重定向到相应的页面(test2.php),但将值保留为空白(导致localhost / test2.php?one =)。 This means I can no longer see what variable was being sent.
这意味着我不再能看到发送了什么变量。
$one = $_GET['one'];
echo $one;
How can I properly send the variable from test.php to test2.php? 如何正确地将变量从test.php发送到test2.php?
Remove quotes from the href
value: 从
href
值中删除引号:
<a href="test2.php?one=<?php echo $_GET['one']; ?>">link</a>
<!-- ^^^ - quotes missing here -->
您关闭了href尝试这个:
<a href="test2.php?one=<?php echo $_GET['one']; ?>">link</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.