[英]Get a variable from href with id
How can I get the id as a variable from that statement in same page? 如何从同一页面中的语句中获取id作为变量?
I need to capture the #dialog
to display in a popup and can't do that if I send the id to a different page. 我需要捕获
#dialog
以在弹出#dialog
中显示,如果我将id发送到不同的页面,则无法执行此操作。
<a href="#dialog?id=<?php echo $image['image_id']; ?>" name="modal" class="info">Link</a>
I've been using this to get it from the link but I need to capture it in same page. 我一直在使用它来从链接中获取它,但我需要在同一页面中捕获它。 This is what i was using :
这就是我使用的:
$img = isset($_GET['id'])
Everything after the Hash-Sign is evaluated by the browser only and not sent to the server. Hash-Sign之后的所有内容仅由浏览器评估,而不是发送到服务器。 You therefore cannot access it.
因此,您无法访问它。
Maybe you meant: 也许你的意思是:
?id=<?php echo $image['image_id']; ?>#dialog
Otherwise you would have to use JS. 否则你将不得不使用JS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.