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 5964079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:22:01+00:00 2026-05-22T19:22:01+00:00

As you can see in the code below, I have 2 flags my and

  • 0

As you can see in the code below, I have 2 flags my and hk.
When I click on the hk flag, it will redirect to the hk page and at the same time will disable the hk button to show the difference from other buttons.

So,what php code do I use to disable only the button that is clicked?

<button id="btn_my" dojoType="dijit.form.Button" 
  onClick='location = "<?php echo url_realurl();?>/results/view/all/M"'>
<?php 
  echo ci_create_img('my');
?> <!--this is malaysia flay image -->
</button>
<button id="btn_hk" dojoType="dijit.form.Button" 
  onClick='location = "<?php echo url_realurl();?>/results/view/all/H"'>
<?php 
  echo ci_create_img('hk');
?><!--this is hongkong flay image-->
</button>
  • 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-22T19:22:02+00:00Added an answer on May 22, 2026 at 7:22 pm

    You could read the $_SERVER['REQUEST_URI'] and disable the button if it links to the current page. Example:

    <?php
    $countries = array(
        'my'    =>  '/results/view/all/M',
        'hk'    =>  '/results/view/all/H',
    );
    ?>
    
    <?php foreach ($countries as $code => $uri): ?>
    
        <?php if ($_SERVER['REQUEST_URI'] === $uri): ?>
        <button class="disabled">
        <?php else: ?>
        <button onClick='location="<?php echo url_realurl().$uri; ?>"'>
        <?php endif; ?>
            <?php echo ci_create_img($code);?>
        </button>
    
    <?php endforeach; ?>
    

    You might want to trim($uri, '/') and trim($_SERVER['REQUEST_URI'], '/') there to make sure there are no mistakes with slashes.

    You could also append a $_GET variable to the link like ?country_code=hk and read that instead:

    <?php foreach ($countries as $code => $uri): ?>
    
        <?php if ($_GET['country_code'] === $code): ?>
        <button class="disabled">
        <?php else: ?>
        <button onClick='location="<?php echo url_realurl().$uri.'?country_code='.$code; ?>"'>
        <?php endif; ?>
            <?php echo ci_create_img($code);?>
        </button>
    
    <?php endforeach; ?>
    

    There, you should also make sure to check if isset($_GET['country_code']), and any other links on the page would most likely have to use the query string as well. I was trying to make this readable. I would just write a function for reading the url personally.

    I prefer the first approach. Sorry, I had to craft it in my coding style, but hopefully you get the idea and this works for you.

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

Sidebar

Related Questions

I have an ordered list which uses large Georgia for the numbering and smaller
Scenario : What I have is an upload form that reports on the upload
I have an a div with position:absolute . I'm trying to position it to
I ran into a bug I have trouble explaining. Now that I found the
I have the following XML: <xmlRequest> <stats> <match mid='40704828'> <match_stats> <ms aid='254664' cli_name='Hero_Engineer'> <stat
I have a list () in a table cell which elements contain a label
I need to pass an instance variable (self.rank) to be used by a class
This question has been bugging me a LOT lately. Any help would be appreciated.
I am working on an object to allow us to modify PHP files containing
Autofocus is not working on the first AVCaptureSession when I create a second AVCaptureSession.

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.