<?php
//--- Validating the name Input value.
if(empty($name))
{
die(" No Name submitted");
}
//--- Validating whether the length of the name Input value Is between 5 to 50 characters.
elseif ( (strlen($name) < 5) || (strlen($name) > 50))
{
die("Invalid name");
}
else
{
//--- Printing the name Input value.
echo $name;
}
?>
I use the above code to check if the name enter is in the correct format. The $name is a value which was gotten from a html form .
But somehow the code is not working , regardless of whether there is any name enter , the message " No Name Submitted" would be printed out ......