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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:12:11+00:00 2026-06-05T09:12:11+00:00

On Codeigniter, if you create a member using a signup form and sending data

  • 0

On Codeigniter, if you create a member using a signup form and sending data to an insert method in your model member, how do you filter data?

I’m looking for the best MVC way to do that, because I don’t want to save the value of the checkbox “I agree with…”, neither the value of a security question or this kind of things.

In my controller, it’s possible to do (before sending to model method):

$posts = $this->input->post();
unset($posts['abcdef']);
...

But it’s also possible to do that in my model (before using insert method):

function insert($data){
unset($data['abcdef']);
...
}

So, how do you do to filter data?

  • 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-05T09:12:12+00:00Added an answer on June 5, 2026 at 9:12 am

    Both ways you posted work – but they are a “black-list”.

    You should instead use a “white-list” in your model. This means your model will only look for the information its wants, and discards the rest. This prevent people from inserting addition $_POST data into your forms that you were not expecting.

    In the model I do something like

    function insert($inputs)
    {
        $white_list = array ('field1', 'field2', ... ,'field9');
        foreach ($inputs as $post_id => $input)
        {
            if ( ! in_array ($post_id, $white_list))
            {
                unset($inputs[$post_id]);
            }
         }
        // Now insert data here and sleep easy at night
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CodeIgniter and I want to create some sort of filter to know
I'm using codeigniter to create a web app. I'm creating the drop down menus
Currently I have create a website using codeigniter. I got a message error every
I am building a web app using Codeigniter 2.0.3. I need to create base
Using PHP and/or Codeigniter, I want to create some string templates to be store
I'm using CodeIgniter to develop a new web app, and I'd like to create
I am developing a web app using Codeigniter and MongoDB. I need to create
I create a login page creating at first the controller using codeigniter php and
I have create a web application using CodeIgniter making at first a login interface.
I want to create secure cf using CodeIgniter. I'm new to using CodeIgniter. Is

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.