title: Codeigniter POST/GET variables and $this->input->post
body: <p>I have an issue with post variables in Codeigniter, for now I fixed it, but I'm not sure if this is fine, in other words, I'd really like to know why I had issue only on hosting server, not on local.</p>
  
  <p>The problem:
  I wanted more secure script so I replaced $_POST/$_GET with $this->input->post and $this->input->get, like in this example:</p>
  
  <pre><code>if(!empty($this-&gt;input-&gt;get('endDate'))){
     $data['datepicker'] = $this-&gt;input-&gt;get('thisDate');
  }
  </code></pre>
  
  <p>this was all working fine on my localhost, but I assume it is wrong way, as when I deployed to the hosting server, I've got ajax parse error from <a href="https://github.com/posabsolute/jQuery-Validation-Engine" rel="nofollow">validation engine</a> that I'm using, I couldn't log in the system, getting all the time ajax parse error, and somehow figured out that whenever I checked if empty$this->input->post('var) or the same with get, was wrong.</p>
  
  <p>I have checked the input class from Codeigniter and figured out, that $this->input->post is returning true/false, so I changed the scripts in the format like this:</p>
  
  <pre><code>if(!($this-&gt;input-&gt;get('endDate'))){
     $data['datepicker'] = $this-&gt;input-&gt;get('thisDate');
  }
  </code></pre>
  
  <p>this worked fine.
  I'm still wondering - why the code worked on the localhost, but it didn't on the server or what is the best way to check if the POST/GET variable is empty or not.Seems I really miss something out.</p>
  
  <p>Thank you.</p>