[英]Check if <a> tag has been clicked with PHP
如何檢查 HTML 中的<a>
標簽是否在 PHP 中被點擊?
我已經嘗試過if(isset[$_GET[ "idofLink"])
,但在這種情況下,我得到了else
語句。
<li class="active"><a name = "profile" href="includes/submit-profile.php">Profile</a></li>
if(isset("profile")){
// Do something....
} else{
// Do something else ...
}
您應該在鏈接中添加一個查詢部分,例如... href="includes/submit-profile.php?submit_profile" ...
,以便稍后您可以檢查該鏈接是否被點擊。 所以完整的<li>
元素應該是這樣的:
<li class="active"><a name = "profile" href="includes/submit-profile.php?submit_profile">Profile</a></li>
這就是您可以檢查該鏈接是否被點擊的方法:
if(isset($_GET['submit_profile'])){
// do something
}else{
// do something else
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.