2016-12-01 53 views
-2

我得在URL僅有2參數順序問題 http://localhost/StudentGuideBook/AdminPanel/viewInstitute.php?type=Govermnet&Category=University我faceing關於URL

我會得到這個第一次當我的兩個值,但在此之後,我將獲得此類型的點擊鏈接 http://localhost/StudentGuideBook/AdminPanel/viewInstitute.php?type=Govermnet&Category=University&Category=College&type=Govermnet

我想重寫的值是鏈接不要連接這個 anny解決方案???

在代碼中我檢查服務器的完整URL爲 $ CompleteLink ='http://'。 $ _SERVER ['HTTP_HOST']。 $ _SERVER [ 'REQUEST_URI'];

<div class="just-padding"> 
 
       <div class="list-group list-group-root well"> 
 
        <a href="#" class="list-group-item">Search By Type</a> 
 
        <div class="list-group"> 
 
         <?php 
 
         if (strpos($CompleteLink, $mark) !== false){ 
 
          echo "<a href='$CompleteLink&type=Private' class='list-group-item'>Private Institutes</a>"; 
 
          echo "<a href='$CompleteLink&type=Govermnet' class='list-group-item'>Goverment Institutes</a>"; 
 
          echo "<a href='$CompleteLink&type=all' class='list-group-item'>All Institutes</a>"; 
 
         } else { 
 
          echo "<a href='" . BASE_URL . "AdminPanel/viewInstitute.php?type=Private' class='list-group-item'>Private Institutes</a>"; 
 
          echo "<a href='" . BASE_URL . "AdminPanel/viewInstitute.php?type=Govermnet' class='list-group-item'>Goverment Institutes</a>"; 
 
          echo "<a href='" . BASE_URL . "AdminPanel/viewInstitute.php?type=all' class='list-group-item'>All Institutes</a>"; 
 
         } 
 
         ?> 
 
        </div> 
 
       </div> 
 
       <div class="list-group list-group-root well"> 
 
        <a href="#" class="list-group-item">Search By Category</a> 
 
        <div class="list-group"> 
 
         <?php 
 
         if (strpos($CompleteLink, $mark) !== false){ 
 
          echo "<a href='$CompleteLink&Category=University' class='list-group-item'>University</a>"; 
 
          echo "<a href='$CompleteLink&Category=College' class='list-group-item'>College</a>"; 
 
          echo "<a href='$CompleteLink&Category=Technical Academy' class='list-group-item'>Technical Academy</a>"; 
 
         } else { 
 
          echo "<a href='" . BASE_URL . "AdminPanel/viewInstitute.php?Category=University' class='list-group-item'>University</a>"; 
 
          echo "<a href='" . BASE_URL . "AdminPanel/viewInstitute.php?Category=College' class='list-group-item'>College</a>"; 
 
          echo "<a href='" . BASE_URL . "AdminPanel/viewInstitute.php?Category=Technical Academy' class='list-group-item'>Technical Academy</a>"; 
 
         } 
 
         ?> 
 
        </div> 
 
       </div> 
 
      </div>

This is the link i am getting

+0

這個問題如果回答也會留在Stack的「未解決」部分?你應該將解決的問題標記爲「解決」,否則人們可能會發布更多答案,認爲他們沒有解決。 –

+0

這是未解決的問題,我將標記爲我的問題解決 –

回答

0

我認爲在某種程度上這是呼應之前$CompleteLink突變。 如果你不想通過你的代碼來找出它發生了什麼變異,你可以在你迴應它之前試着做$CompleteString = substr($CompleteLink, 0, (strpos($CompleteLink, '?')));