CodeIgniter Forums
Validated form data - where does it go?!? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Validated form data - where does it go?!? (/showthread.php?tid=14928)



Validated form data - where does it go?!? - El Forum - 01-20-2009

[eluser]juddmuir[/eluser]
Hi,

I'm using the form validation class to trim and validate form data:

$this->form_validation->set_rules('classified_title', 'lang:classified_title', 'trim|required|xss_clean');

But once validated, where do I get the trimmed data? If I use the post array, then I've lost the data that's been processed :-(

Where does the submitted data go once it's been validated?!?


Validated form data - where does it go?!? - El Forum - 01-20-2009

[eluser]GSV Sleeper Service[/eluser]
the validation ruless (trim, xss_clean etc) are performed directly on the $_POST array, so using $this->input->post() will be fine.
a comment from the form_validation class
Code:
/**
     * Re-populate the _POST array with our finalized and processed data
     *
     * @access    private
     * @return    null
     */



Validated form data - where does it go?!? - El Forum - 01-20-2009

[eluser]juddmuir[/eluser]
Thanks!


Validated form data - where does it go?!? - El Forum - 01-20-2009

[eluser]Michael Wales[/eluser]
Validated form data can be found in:
Code:
$this->input->post('field');
$_POST['field'];
$this->validation->field;

Personally, I would use the Input class - there's no difference right now between the three, but in the future this may change. The Input class was designed to access this data specifically, in theory you should never touch the $_POST array yourself - let the framework do it for you.