You are trying to countDocs something that is not an array, but rather a string.
As documented, count returns 1 for strings, regardless of their lengths.
You can use the strlenDocs function instead, as it counts the number of ascii characters in that string:
if (strlen($_POST['tickboxes']) > 0) {
echo "found";
}
Additionally, you can use the emptyDocs language construct for this, it will check if it's an empty array or a blank string, or the integer 0 or the string '0' - and that last one may cause you grief (depending on what you are doing with it, i.e. if your users can send you such input).
If empty would be an option for you, you can just spare that as well:
if ($_POST['tickboxes']) {
echo "found";
}
Don't forget to check if that key in the $_POST array exists if you do so. If you're unsure, empty won't give you any warning:
if (!empty($_POST['tickboxes'])) {
echo "found";
}
var_dump($_POST['tickboxes']);in your question. I bet there is a string inside$_POST['tickboxes']is set, any set variable will at least return1withcount. Unset variables will return0(variables which containNULLare not set in PHP). Arrays and Objects will return their count. Please read the documentation of the return value.