Here is the simple code i use for minimum 3 characters check.
I would like to make an exception if query is fully numeric ( code also has an option to search by case IDs, which are shorter than 3 characters).
<?php
if (strlen($_POST['Search'])>=3) {
include 'search.php';
} else {
$message = '3+ characters, please';
}
?>
Thanks for help 🙂
You should write something like this:
Feel free to merge the branches is the default case and the “all digits” case should forward to the same code.
Important: Use only
ctype_digitfor checking if the input is all digits.is_numericwill returntruefor other types of input as well: