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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:37:17+00:00 2026-05-19T11:37:17+00:00

I have a feature on my users inbox that allows users to check/uncheck messages

  • 0

I have a feature on my users inbox that allows users to check/uncheck messages in their inbox that they want to make favourite.

I’m currently testing what happens when a user checks the box (clicks on the image and causes it to go from greyed out to colour meaning the box is checked).

Anyway as you can see from the code below when the box ischecked this url is suppose to be loaded: http://mysite.com/messages/favourite_checked

The message_id of the row the user has checked the box on is suppose to be added onto the end of the url this then loads my controller “messages” and method “favourite_checked” which then passes a variable that grabs the message_id from the url, stores it in a variable then sends it the my model and it is used in a mysql query.

Basically I update the favourites column of my messages table and set it to = 1 where the message_id from url matches the one in the messages table in my database. So yea, where the match is found the “favourite” column in that row is updated to 1. 1 = favourite 0 = not favourite.

Any I just thought I would make it clear what was happening..

My problem is nothing happens when I check the box, nothing is updated so I feel I must be doing something wrong where I try to add the id to the url in the javascript function.

I’ve tried $(post) also.. nothing happens then also.

Maybe someone can spot it because I really don’t know what the problem is.

<script type="text/javascript">

// favourite check box
    $('input.favourite:checkbox').simpleImageCheck({
  image: '<?php echo base_url()?>images/messages/check.png',
  imageChecked: '<?php echo base_url()?>images/messages/unchecked.png',
  afterCheck: function(isChecked) {
    if (isChecked) {



  //query to db from php to update favourite number to 1
  $.get('http://mysite.com/messages/favourite_checked'+'<?php foreach ($query as $row):  ?><?php $row['id']; ?><?php endforeach; ?>');

    }
//    else (!isChecked)
//        {
//            //query to db from php to update favourite number to 0
//              $.get('http://mysite.com/messages/favourite_unchecked');
//        }
  }
});
</script>
  • 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-19T11:37:18+00:00Added an answer on May 19, 2026 at 11:37 am

    I think your basic problem is some confusion about when the PHP is running vs the javascript.

    The PHP you put on the page is server side, it will load first, then the javascript will run client-side.

    This part here:

    $.get('http://mysite.com/messages/favourite_checked'+'<?php foreach ($query as $row):  ?><?php $row['id']; ?><?php endforeach; ?>');
    

    Seems like you are wanting this to be dynamic based on what you checked, but I don’t see how that url is going to show specifically what you are looking for.

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

Sidebar

Related Questions

We have a search feature that allows users to search based on product description.
I have a feature called Browse that allows users to browse through random profiles.
I have a javascript feature that allows users to place arbitrary text strings on
I want my site to have a feature for users to upload images, but
I have a web app (sencha/phonegap) that includes a feature allowing users to click
I have an existing webapp and want to add a tag feature so that
I have a TabControl that allows users to manage documents such as the following:
I'm developing a poll feature that allows users to create poll questions with options
I have an ASP.Net calendar feature which allows users to add events and configure
We have a web app that has a built-in search feature that our users

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.