pass an argument to controller function |
[eluser]rotivo[/eluser]
Hello, i want to pass an argurment to controller function but i don“t want to show this argument in the URI... how can i do it? Thanks.
[eluser]boltsabre[/eluser]
The most common ways to pass it is either as a form element (generally an input with type="hidden"), or via a session/flashdata or cookie. hidden inputs are still open to easy manipulation by users, there are now browser plugins that easily let users play with post data, so this is not a secure way of passing sensitive information!!! Same applies to cookies, very easy for the user to alter the data in them. What are you trying to do?
[eluser]rotivo[/eluser]
In an a form I pass 1 if the form was sent correctly and 0 if the form sent fails...in the controller depends of the param, loads a view or other...thanksss
[eluser]Samus[/eluser]
[quote author="rotivo" date="1337786188"]In an a form I pass 1 if the form was sent correctly and 0 if the form sent fails...in the controller depends of the param, loads a view or other...thanksss[/quote] Why don't you utilize the resources CI gives you? You can do this simply with the form validation class. e.g Code: if ($this->form_validation->run() == FALSE) http://ellislab.com/codeigniter/user-gui...ation.html
[eluser]rotivo[/eluser]
Because I only load a popup if the form sent is successs, the page is the same..not change! but i can try in your way...
[eluser]Samus[/eluser]
[quote author="rotivo" date="1337786786"]Because I only load a popup if the form sent is successs, the page is the same..not change! but i can try in your way...[/quote] In that case, you could use it to check if the form validation is successful, if it is, assign a variable and then use that variable to determine whether the popup should load or not. e.g Code: if ($this->form_validation->run() == FALSE) then in your view. Code: if($success) { That's just off the top of my head though, i'm sure you can improve it. ![]()
|
Welcome Guest, Not a member yet? Register Sign In |