Posted by Phil Latio on 06/20/07 03:47
Below is a function I've written for validating URLs.
function isURL ($string, $fieldname)
{
if(preg_match("/^[http://www.|www.][\S]+$/", $string))
{
return TRUE;
}
else
{
$this->number_of_errors++;
$this->error_message_list[]="The " .$fieldname. " is not a valid URL.";
return FALSE;
}
}
However I keep getting the error message:
Warning: preg_match() [function.preg-match]: Unknown modifier '/'
This is the code that I call it:
if ($testValidate->isURL($testString11,"String 11"))
{
echo "The string <b>".$testString11."</b> passed.";
}
else
{
echo "The string <b>".$testString11."</b> failed.";
}
What have I obviously missed?
Cheers
Phil
Navigation:
[Reply to this message]
|