Welcome Guest, Not a member yet? Register   Sign In
Access $this->validation->Name inside Models
#11

[eluser]Benedikt[/eluser]
Not give any parameter when I call the model?
#12

[eluser]Colin Williams[/eluser]
Well.. that's how I would do it. As I mentioned above. I would just pass your model's method whatever values it needs
#13

[eluser]Benedikt[/eluser]
I dont really get ur way.

Can u give a very short sample how this would look like?
#14

[eluser]Randy Casburn[/eluser]
[quote author="Colin Williams" date="1215959031"]Well.. that's how I would do it. As I mentioned above. I would just pass your model's method whatever values it needs[/quote]

Me too. After all the discussion, Collin and I (I think) are saying the same thing. All of the data is already available to you in several ways. Since you ran it through validation, and XSS it, the validation run() method automatically made all the values available to you in the input object ( $this->input ), the validation object ($this->validation) or the superglobal $_POST. They have all been 'cleaned' and all contain your validated data.

You can use the method in the examples here which show you how to us $_POST:
http://ellislab.com/codeigniter/user-gui...odels.html
or, has been discussed and re-discussed, you can use the input class as I recommended in my very first post. This really should be the prescribed method of working with your cleaned data that is returned from your forms and has been XSS cleaned:
[url/http://ellislab.com/codeigniter/user-guide/libraries/input.html[/url]

In your Model, you simply use $this->input->post('fieldname') to access your data. It's as simple as that.

Randy
#15

[eluser]Benedikt[/eluser]
Understood and got it to work :-)

Thanks for your detailed help on this!!!




Theme © iAndrew 2016 - Forum software by © MyBB