Hi
I am a newbie and struggling with my guestbook validation process.
I have found the following function online to check the length of a
form field.
<?php
function checkLength($st ring, $min, $max) {
$length = strlen ($string);
if (($length < $min) || ($length > $max)) {
return FALSE;
} else {
return TRUE;
}
}
?>
Now below is the area in my code where I have to fit what that function
returns but I can't do it. The "Text" field is the one that has to be
checked for a certain length (Like $min = 1, $max = 100).I would like
to point to the error.html file if checkLength returns false.
$Text = $_POST['Text'] ;
$email = $_POST['email'] ;
$name = $_POST['name'] ;
if (empty($name) || empty($email)) {
header( "Location: error.html" );
}
else
{
//The fields are entered in the database here if it all goes fine.
Thanks a lot
Patrick
I am a newbie and struggling with my guestbook validation process.
I have found the following function online to check the length of a
form field.
<?php
function checkLength($st ring, $min, $max) {
$length = strlen ($string);
if (($length < $min) || ($length > $max)) {
return FALSE;
} else {
return TRUE;
}
}
?>
Now below is the area in my code where I have to fit what that function
returns but I can't do it. The "Text" field is the one that has to be
checked for a certain length (Like $min = 1, $max = 100).I would like
to point to the error.html file if checkLength returns false.
$Text = $_POST['Text'] ;
$email = $_POST['email'] ;
$name = $_POST['name'] ;
if (empty($name) || empty($email)) {
header( "Location: error.html" );
}
else
{
//The fields are entered in the database here if it all goes fine.
Thanks a lot
Patrick
Comment