PHP, if / else çalışmıyor anahtarı

0 Cevap php

Goal: Trying to get a rollover button state to remain "ON" when URL equals "enhanced.php".

Problem: Button state does not remain "on" when URL equals "enhanced.php".

(Button rollover olarak doğru davranır)


bir fark yaparsa sidemenu.php sidemenu.php bir PHP olarak kullanıldığı tüm sayfalarda include (ben bilmiyorum

<?php

$script = $_SERVER['SCRIPT_NAME'];


//Set the default state to OFF and only turn ON if we are on the current URL.

$enhancedstate = OFF;


$pos = strpos($script, "enhanced.php");
if($pos === true) {
$enhancedstate = ON;
}


?>


 <div class="sideMenu">   

   <a href="enhanced.php" 
      onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','/images/Button_ON_01.gif',1)">
      <img src="/images/Button_<? echo $enhancedstate; ?>_01.gif" name="Image1" border="0">
   </a>

Anyone see any reason why the button state does not stay "ON" when the current URL is "enhanced.php". TIA

0 Cevap