Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3218038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:28:52+00:00 2026-05-17T15:28:52+00:00

Goal: Trying to get a rollover button state to remain ON when URL equals

  • 0

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 acts correctly as a rollover)


sidemenu.php sidemenu.php is used as a PHP include on all pages (I don’t know if that makes a difference

<?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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:28:53+00:00Added an answer on May 17, 2026 at 3:28 pm

    strpos returns a int on success, and FALSE on failure.

    Change if($pos === true) to if($pos !== false).

    The === operator compares values and types. So, on success strpos returns an int, which may have the same value as TRUE, but it’s not the same type.

    EDIT: As others have said, you should change:

    $enhancedstate = OFF to $enhancedstate = 'OFF'

    PHP is very forgiving, and will let you use un-quoted strings, but you should try not to, unless ON and OFF are actually constants.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get my head around a LINQ issue. The ultimate goal
I have been trying to get this code to work for a while now
I'm trying to get a grip on the OCaml language syntax and am having
I'm trying to get a better grasp of the inner workings of background jobs
I am trying to get a random color. I have done it using brute
I am trying to get the number of specific nodes in an XML file
I'm trying to get a simple REST service to work with Spring 3.0 but
I am trying to get up a simple authentication system with Rails' Restful-Authentication plugin,
I'm trying to get a read on the effort level involved in building a
Goal Java client for Yahoo's HotJobs Resumé Search REST API . Background I'm used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.