Thanks LarsLai and jonno946. I tried both but couldn't get them working just right. I tried jonno946's suggestion:
if(strlen($_POST['$search_term'] < 3) {
echo "too short";
exit;
}
and if I entered in a word over 3 characters in length it never would show the results in the results.php page. I think the "exit" just stopped the script whether I have less or more than three character. However, it only showed the text "Your Keyword Must Be Longer Than 3 Characters" if there were less than 3. So I tried this:
//
if(!$search)
{
echo("Please Input Something To Search For");
}
else
{
if(strlen($_GET['search']) <= 3){
print "<p><b>Your Keyword Must Be Longer Than 3 Characters</b><br>";
}
//
It works but not like it should. When I type a single character, say "A" in the search field, it prompts me that "Keyword Must Be Longer Than 3 Characters" (which it should) but it continues to show the results that have the letter "A" in thier business name without stopping the script.
I need to have a script that:
1) Checks for an empty search field
-If it is empty, it prompts "Please Input Something To Search For"
-If it is not empty then it continues
2) Then check to see if the field has more than 3 characters
-If it doesn't, it prompts "Keyword Must Be Longer Than 3 Characters"
-If it does, then it continues with the rest of the script, eventually showing the results
Any other suggestions? Thanks in advance.