$_POST['var'] isset but $this->input->post('var') returns FALSE |
[eluser]ScottBruin[/eluser]
I'm using jQuery's $.load ajax function to send some POST variables. Sometimes, my variable q is set to ''. (That is, I send a jquery object { 'q': '' } with the $.load function. When I try to load $this->input->post('q') with CI, it returns FALSE. However, if I do something like below, I am told that $_POST['q'] is set Code: if (isset($_POST['q'])) { echo 'post is set'; } According to the user guide for <b>$this->input->post()</b>: Quote:The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist.Source: http://ellislab.com/codeigniter/user-gui...input.html What exactly "if the item...does not exist" means is ambiguous at best. For me, I think, I'm trying to retrieve the $_POST item 'q' and it does exist though it has no value. Also, I just created a test for this without any jQuery involved and the behavior is the same. Here's the controller I used: Code: <?php
[eluser]Seppo[/eluser]
Well... you should use !== instead of !=, because PHP evaluates '' == FALSE as true
|
Welcome Guest, Not a member yet? Register Sign In |