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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:54:27+00:00 2026-05-19T05:54:27+00:00

I have a for each loop on the inbox page of my website: <table

  • 0

I have a for each loop on the inbox page of my website:

<table width="40%" border="0">
  <tr><p id="links">
    <a href="#" id="all" class="pseudo">all</a>,
    <a href="#" id="none" class="pseudo active">none</a>,
    <a href="#" id="read" class="pseudo">read</a>,    
    <a href="#" id="unread" class="pseudo">unread</a>,
    <a href="#" id="replied" class="pseudo">replied</a>,
    <a href="#" id="fav" class="pseudo">favourite</a>
</p>
    <td width="5%"></td>
    <td width="5%"></td>
    <td width="22%"></td>
    <td width="19%"></td>
    <td width="60%"></td>
    <td width="17%"></td>
  </tr>

 <?php foreach ($query as $row):  ?>
  <tr>
    <?php switch($row['status']){
        case 0: $status = "unread"; break;            
        case 1: $status = "read"; break;
        case 2: $status = "replied"; break;
        case 3: $status = "fav"; break;
        default: $status = '';           
    }?>

    <td width="5%"><input name="message" id="messages" type="checkbox" value="" class="<?php echo $status; ?>"/></td>
    <td width="5%"><input name="sunny" id="sunny" type="checkbox" value="" class="" checked="checked" /></td>
    <td><?php echo $status; ?></td>
    <td><?php echo $row['from_user']; ?></td>
    <td><div id="test"><a href="<?php echo site_url("messages/read_message/".$row['id']); ?>"><?php echo $row['subject'] . " " . $row['message']; ?></a></a></div></td>
    <td><?php if ($row['date_sent'] == date('Y-m-d')) { echo $row['time_sent']; } else echo $row['date_sent']; ?></td>
  </tr>
<?php endforeach; ?> 
</table>

This line is not being repeated on my actual view page:

<td width="5%"><input name="sunny" id="sunny" type="checkbox" value="" class="" checked="checked" /></td>

Basically it’s a image replacement for a checkbox that changes when it’s clicked on to a ticked image or an unticked image.

This image is only appearing on the first returned message in my database. The other 4 messages that are grabbed from my database show a checkbox and this is incorrect because there should be an image checkbox just like the first message for every other message. I’m guessing because there isn’t any php to process in that line that it isn’t been included foreach loop.

The purpose of this image checkbox is to make it easy for users to recognise what messages in their inbox they have set to favourite.

How would I solve this?![alt text][1]

  • 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-19T05:54:28+00:00Added an answer on May 19, 2026 at 5:54 am

    The output HTML is most certainly correctly repeated. I’d guess you change the looks of the checkbox using Javascript or CSS based on the id of the checkbox. Every checkbox has the id="sunny" though, which is incorrect. An id needs to be unique on the page. I suppose that’s why your CSS/Javascript only affects the first checkbox.

    Use a class if you have more than one element you want to apply something to.

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

Sidebar

Related Questions

I have a page which displays my database information. Through each loop, there is
I have a For..Each loop which loops trough all grid's rectangles and changes the
I have following jQuery .each loop : $('.table-data tbody tr td').each( function(index) { $('.table-data
I have this each loop: (haml) - @deals.each do |a| .slide %a{:href => #}
I have the following for each loop to get sum of all child objects.
I have an .each loop in jQuery. I want to iterate the loop one
I have a For Each loop that is looping through an array of strings
I have a for each loop like this $sn_count = 1; $prodfilter = ;
i have a loop where a variable value will change in each loop and
The following code returns the error from the For Each loop. I have similar

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.