Can somebody tell me what's wrong with the strlen function in my search function you must enter 4characters to search the database if you enter 0 to 3 character is must give the text "Sorry, je zoekopdracht is te kort"
<?php
include("kgconnectie.php");
if ((!empty($POST["zoeken"])) || (strlen($POST["zoeken"]) < 3)){
}
else
{
echo "Sorry, je zoekopdracht is te kort.";
}
$query="SELECT debiteurnr, klantnaam, woonplaats FROM kg WHERE " . $POST["zoeken"];
switch ($POST["zoeken"])
{
case "debiteurnr":
$query . " = " . $POST["trefwoord"] . "'";
case "klantnaam":
$query .= " LIKE '%". $POST["trefwoord"] . "'";
break;
case "woonplaats":
$query .= " LIKE '%". $_POST["trefwoord"] . "'";
break;
default:
break;
}
$result = mysql_query($query) or die ("FOUT: " . mysql_error());
$aantal = mysql_num_rows($result);
?>
<html>
<head>
<title>Zoek</title>
<style><!--a{text-decoration:none}//-->
<!--a:hover{color:red; }-->
</style>
</head>
<body bgcolor="#EBEBEB" LINK="#000000" VLINK="00OOOO" ALINK="00OOOO">
<h2>U hebt op <?php echo($POST["zoeken"]);?>
<?php echo($POST["trefwoord"]);?> gezocht.</h2>
<a href="kgzoekfuncties.php"><u>Nieuwe zoekactie</u></a>
<br>
<br>
<table bgcolor="#FFFFFF" border="4" width="*%" align="left">
<tr> <td colspan="2" align="center"><h2>Klantgegevens</h2></td></tr>
<tr bgcolor="#EBEBEB"><th><font COLOR=FF0000>Klantnaam</font></th></tr>
<?php
if ($aantal == 0){
echo ("<b><center><b><FONT COLOR=red>Helaas, er werden geen gegevens gevonden!
</FONT><center></b></b><br>\n");
}else{
echo("<b>Er werden $aantal record(s) gevonden</b><br><br>");
while (list($DebiteurNr, $Klantnaam) =
mysql_fetch_row($result)){
echo("<tr><td><a href=\"kgresult.php?debiteurnr=$DebiteurNr\">$Klantnaam</a></td></tr>\n");
}
}
?>
</table>
</body>
</html>