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

  • SEARCH
  • Home
  • 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 8296737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:08:08+00:00 2026-06-08T15:08:08+00:00

Coding Follow/Unfollow system in CodeIgniter(PHP) & Twitter-Bootstrap. Am also having routes active for the

  • 0

Coding Follow/Unfollow system in CodeIgniter(PHP) & Twitter-Bootstrap. Am also having routes active for the URLS. Follow Button code in VIEW.

 <!-- Follow Button Start -->
<?php $is_logged_in = $this->session->userdata('is_logged_in'); ?>
<?php if(!(empty($is_logged_in)) && $sID != $vID && !in_array($sID, $following)): ?>
    <button class="btn" type="submit" onClick="location.href='<?php echo site_url("follow/$vUsername"); ?>'">Follow <?php echo $vUsername; ?> </button>
<?php elseif (in_array($sID, $following)):?>
    <button class="btn" type="submit" onClick="location.href='<?php echo site_url("unfollow/$vUsername"); ?>'">UnFollow <?php echo $vUsername; ?> </button>
<?php else: ?>
    <button class="btn disabled" type="submit">Follow <?php echo $vUsername; ?> </button>
<?php endif; ?>
<!-- Follow Button End -->

Even If the User is not Following than too the Button shows UnFollow $vUsername

  • 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-06-08T15:08:12+00:00Added an answer on June 8, 2026 at 3:08 pm

    I can’t fully test it here, but this would make more sense to me:

    <?php if((!empty($is_logged_in)) && ($sID != $vID) && (!in_array($sID, $following))): ?>
    

    Edit:

    Well, in that case, only simple step-by-step debugging will save you:

    <?php 
    $is_logged_in = $this->session->userdata('is_logged_in'); 
    
    if(!empty($is_logged_in))
    {
        echo '$is_logged_in is not empty';
    }
    
    echo '$sID is: '.$sID.' and it should not be equal to $vID'. $vID;
    
    if($sID != $vID){
        echo 'and indeed it is not';
    }
    else
    {
        echo 'but it is. Here is the problem';
    }
    
    echo 'This is the $following array:';
    print_r($following);
    
    if(!in_array($sID, $following))
    {
        echo '$sID is not in the $following array';
    }
    else
    {
        echo '$sID IS in the $following array';
    }   
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to configure Netbeans PHP to follow Zend Coding Standard? I'm struggling with this
I am trying to configure Emacs v23 to follow Kohana coding standards for PHP.
Consider the following code (for simplicity, I did not follow any C# coding rules).
I strongly try to follow general rules in coding styles. But when i look
PHP mysql database I have created a follow on question to this one here
Please provide some good coding habits that one must follow to optimize vb.net code.
To see the problems, please follow these steps (I am coding in C#): Put
i am into php coding for 1 year now. i don't know everything or
What Delphi coding standards document(s) do you follow? Our company is looking at putting
I was coding a div element, which acts as a loading bar, to follow

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.