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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:43:26+00:00 2026-05-25T10:43:26+00:00

This is more of a theoretical question than a specific one. I have a

  • 0

This is more of a theoretical question than a specific one.

I have a form set up with CodeIgniter’s Form Validation class. I have some rules being run, for example:

$this->form_validation->set_rules('address_line_1', 'Address Line 1', 'required|xss_clean|trim');

I eventually want to put the address_line_1 data into my Database. This is where I’m a little confused. It seems there are several ways of fetching $_POST data from within CodeIgniter:

  1. $address = $_POST['address_line_1'];

  2. $address = $this->input->post('address_line_1');

  3. $address = $this->form_validation->set_value('address_line_1');

  4. $address = set_value('address_line_1);

So which way is the ‘correct’ way?

Whilst I’m sure several of these assumptions are wrong, I’ve been led to believe that…

  • $_POST is unsanitised by CodeIgniter’s security (I’m confident about this one)

  • $this->input->post() will sanitise the data (to a certain extent), but won’t have applied any Form Validation prepping rules

  • $this->form_validation->set_value() is the same as set_value(), but…

  • … set_value() is intended to re-populate form inputs via their value="" element.

Which of my assumptions are correct and which are wrong? And what is the way I should be pulling through $_POST data when I’m prepping it with Form Validation? The Form Validation documentation is ambiguous when it comes to this. None of the examples ever show it actually passing input data onto a model, for example.

Thanks!

Jack

  • 1 1 Answer
  • 1 View
  • 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-25T10:43:26+00:00Added an answer on May 25, 2026 at 10:43 am

    They are all different, or they wouldn’t all exist.

    1. $_POST['foo'] is unprotected and raw output. BAD. Don’t touch. etc.
    2. $this->input->post('foo') escaped and XSSified input. Defaults to FALSE instead of erroring.
    3. $this->form_validation->set_value() this will take the validated output, which may have been modified through the validation rules. For example, if you add “trim” as a validation rule, the validated content will be trimmed.
    4. set_value() just an alias of the method above. People don’t like to use $this in their views.

    This is all in the documentation.

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

Sidebar

Related Questions

This is more of a theoretical question than an actual problem I have. If
This is more a theoretical question than a practical one, but given I undestand
This is more of a theoretical question rather than language specific, but I'm mostly
This is more of a theoretical question than anything. I have 3 dictionaries that
This is more of a design question. I have a template class, and I
It's more a theoretical question than a practical one. I know that GC are
This is more of a theoretical question. If I have an arbitrary collection c
This is more of a theoretical question than code: What i did till now
this is more theoretical question. I have written simple chat with my friend. We
This is a theoretical question more than anything else. In the case of C#

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.