So I am having a similar issue to this post: PHP strpos not working, but not quite.
Here is my situation (from a CodeIgniter application):
$_submit = strtolower($this->input->post('form-submit'));
if(strpos('save', $_submit) !== FALSE){
// we have to save our post data to the db
}
if(strpos('next'), $_submit) !== FALSE){
// we have to get the next record from the db
}
The problem is, neither of these actually fire, despite form-submit containing one, or both of those values. The values form-submit receives are: ‘save’, ‘save-next’, and ‘skip-next’ (which I have confirmed by looking at the post data as it comes in). Now for the real head scratcher, I also have this line in the same code chunk:
if ($_submit === 'add-comment'){
//do something
}
And that works perfectly fine. So === is working as expected, but !== is not?
You are giving arguments wrong to the strpos function…….
Please look into the strpos function in php.net manual….first argument is full string and second one is key string
You can find a small example here also.