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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:17:56+00:00 2026-06-07T11:17:56+00:00

Hi I am trying to echo out check boxes, and then determine if they

  • 0

Hi I am trying to echo out check boxes, and then determine if they are checked in my controller and add them to an array if they are. I have followed a guide from SO but still having issues. Any insight much appreciated!

Controller Code:

       foreach ($content['options'] as $option) {
            $id = $option['id'];
            $checked = (isset($_POST[$id])) ? true : false;
            if ($checked == TRUE) {
                 array_push($recipientGroups, $id);
            }
       }

View Code:

foreach ($options as $option) {
     echo br(1);
     echo $option['name'];

     $checkboxattr = array(
          'name' => $option['name'],
          'value' => $option['name'],
          'id' => $option['id']
    );  //'checkbox_'.

     echo form_checkbox($checkboxattr);
     echo "<span id='total_".strtolower($option['name'])."'></span>";
    }
  • 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-07T11:17:59+00:00Added an answer on June 7, 2026 at 11:17 am

    The blank array you mean is from this variable $checkboxattr?

    In your view, did you get the value of array variable ($options) from the controller?

    If so, have you passed it from the controller ? Because I don’t see any codes in your controller that pass the array to your view.

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

Sidebar

Related Questions

I trying to figure out how to output my php to echo for my
I am trying to print or echo out the contents of the GET and
Hi I'm trying to figure out how to echo back if the value entered
i have been busting my head trying to figure this out. I found this
I'm trying to loop through a multidimensional array, and add a new sub array.
Ok so i have this image uploading thing im trying to add on this
Trying to figure out why my code isn't working. Basically I have an elseif
I'm trying to figure out how to check if the referral url to one
I'm trying to figure out some Bash-foo to check that the output of three
I'm trying to figure out how a way to check for duplicates in an

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.