簡體   English   中英

檢查<a>標簽是否被PHP點擊</a>

[英]Check if <a> tag has been clicked with PHP

如何檢查 HTML 中的<a>標簽是否在 PHP 中被點擊?

我已經嘗試過if(isset[$_GET[ "idofLink"]) ,但在這種情況下,我得到了else語句。

文件file1.php

<li class="active"><a name = "profile" href="includes/submit-profile.php">Profile</a></li>

文件 profile.php

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM