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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:03:11+00:00 2026-05-20T18:03:11+00:00

I have a little checkbox on a signup form im creating which ‘must’ be

  • 0

I have a little checkbox on a signup form im creating which ‘must’ be checked before the user is allowed to continue … Im finding it difficult to figure out how to do this with the form_validation functions as well, basically the ‘agree to terms and conditions’ checkbox MUST be checked in order for the user to continue, if not, an error message displayed, the code i have at the moment is below, if someone could give me a bit of a helping hand that would be great.

Ok, in my view i have the following

$agreeCheck = array( 'name' => 'agreeCheck', 'id' => 'agreeCheck', 'value' => 'agree', 'checked' => set_checkbox('agreeCheck', 'agree', FALSE));
<?php echo form_checkbox($agreeCheck); ?>

and then in my controller i have the following

$this->form_validation->set_rules('agreeCheck', 'Agree to the Terms and Conditions', 'required');

At the moment, it only remembers the value that was clicked if there is a submission, except if its not checked, it doesnt return anything.

  • 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-20T18:03:12+00:00Added an answer on May 20, 2026 at 6:03 pm

    Try this out:

    $this->form_validation->set_rules('agreeCheck', 'Agree to the Terms and Conditions', 'required|isset');
    

    Try this out:

    $this->form_validation->set_rules('agreeCheck', '...', 'callback_terms_check');
    

    And then set up this method in the controller:

    function terms_check() {
        if (isset($_POST['agreeCheck'])) return true;
        $this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!');
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little question about how web browser retrieve webpage? I know this User
I have little snippet for validatin' my form. I need help to position the
I have a form in a booking system which contains a subform which is
First a little introduction. We have an SQL Server Express 2008 database, which schema
I have a little issue, if i select an single checkbox and press f5
I have Joomla 2.5 installed. I developed some little module which generates html code.
Imagine the following scenario. I have a checkbox that the user can check to
I'm a little puzzled with this one. I have a Collection called AllProducts, which
I have an application in which I'd like a user action - checking on
I have a little AJAX function that asks the server whether a particular checkbox

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.