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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:07:48+00:00 2026-05-28T04:07:48+00:00

How can I keep checkboxes selected after the form has been submitted? I found

  • 0

How can I keep checkboxes selected after the form has been submitted? I found the set_checkbox function in the Codeigniter User Guide, but it doesn’t work.

Form field code from the User Guide

<input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
<input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> />

I also googled this and found a couple of workarounds, but they were based on previous versions of Codeigniter. And they were based on Form Validation, which isn’t necessary for my form, because none of the fields are required.

How can I retain the checkbox field value after the form is submitted?

UPDATE: This question is not about form validation and errors. I want to retain the checkbox field value AFTER the page is reloaded. Is jquery a possibility?

  • 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-28T04:07:49+00:00Added an answer on May 28, 2026 at 4:07 am

    You can use CI session to store the form data in the session and retrieve it if there are no POST submitted when page get refreshed. So the logic will be

    If($this->input->post()){
        /* ...load session class
    
        ... Fetch form data as u like
    
        ... Store form data in a session variable */
    }else{
       /* ... Load session class 
       ... Check if session variable exist
       ... Load form data from session variable and set the form values */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to keep the values of checkboxes in a form with the same
Anyone that has installed the new IE9 know if I can keep IE8 installed?
I wonder if I can keep ido from not remembering my history and only
How I can keep all the current formatting for a file type but add
I have implemented VirtualPathProvider class so I can keep all my views in the
Is there any way with subversion or any other VCS that i can keep
I'm working on an HTML class in PHP, so that we can keep all
How can you keep track of time in a simple embedded system, given that
I've reached a point were I can't keep procrastinating the writing of the graphics
When I call a Powershell script, how can I keep the called script from

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.