Pulling data from form_validation in controller |
[eluser]bluematt[/eluser]
I've recently downloaded the 1.7 release to port an app, and I may be being completely dense, but I don't seem to be able to get form data (after being filtered through the form_validation library, hopefully with appropriate data prepping) into the controller. The Code: set_value() e.g. Code: class Test extends Controller { I've scoured the docs, the forums and the library itself to no avail. Have I missed something incredibly obvious? TIA for any help.
[eluser]Randy Casburn[/eluser]
Hi bluematt, Welcome to CodeIgniter! It isn't clear, but you can always use the Input class. Once your data us run through Validation has been cleaned. So you can do this: $this->input->post('some_data'); to gain access to it. Hope this is helpful. Randy
[eluser]bluematt[/eluser]
Thanks for the feedback. Yes, I'd already tried the $this->input->post(), but this doesn't reflect the prepped version of the data, only the raw data from $_POST (presumably after having gone through the XSS filter). I'm happy to use the encrypt() function afterwards on the raw $input->post(), but I thought the point of the data prepping in the form_validation was to remove such things. Oh well, thank again.
[eluser]Pascal Kriete[/eluser]
You have to set_fields for the changes to be applied to the $_POST array. $this->input->post() and $_POST are identical. [EDIT: crap, nvm - that was the old one]
[eluser]Helmi_xisnet[/eluser]
Hi all, is there any concrete solution to this. I'm also wondering how to get the post-validation data inside a controller Edit: found a solution here: http://ellislab.com/forums/viewthread/95074/ which in fact is the same as above. |
Welcome Guest, Not a member yet? Register Sign In |