input->post() and the "isset()" function |
[eluser]jinfusion[/eluser]
All, The following code: Code: if(isset($this->input->post('foods')) && $this->input->post('foods') == '0') produces the following error: Quote:Fatal error: Can't use method return value in write context in {path to file...} on line 126Line 126 is the first line, the IF statement. Is there a way to check the post vars in CI other then just accessing the POST superglobal directly? (which does not produce the error), I like to stay within the framework where possible for clarity's sake. Joel
[eluser]garymardell[/eluser]
$this->input->post('some_data'); The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist. From the userguide. So you need not use the isset function and just see if it is not false.
[eluser]jinfusion[/eluser]
Brilliant! Thanks. I forgot how well thought out these things are in CI.
[eluser]guidorossi[/eluser]
I think you should use the form validation class for this. Something like Code: $this->form_validation->set_rules('foods', 'Foods', 'required|callback_value_check'); and then Code: function value_check($str)
[eluser]jinfusion[/eluser]
This is a modal dialog not triggering postbacks. I have had some trouble getting the last leg (no view) to work right so I decided to roll my own. I would be glad to see an example of a asynchronous multi stage wizard with the Validation class.
[eluser]dalirnet[/eluser]
Code: if($this->input->post('search') != false) |
Welcome Guest, Not a member yet? Register Sign In |