Error while calling a function
| From: | J.F.Kishor | Date: | Tue, 18 Dec 2001 13:26:08 +0000 |
| Subject: | Error while calling a function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78122@lists.php.net to get a copy of this message | ||
hi all,
I have got a problem, when I execute the following script it gives
a Fatal error, could any one tell me why is it ?, If this is a silly
problem please execuse me but, plz do reply me.
The script is
-------------
<html>
<body>
<?
if(!$Phone)
{
?>
<form action="<?echo $PHP_SELF?>" method=post>
<br>
Telephone Number : <input type=text name=Phone value="">
<br>
<input type=submit>
<script language="php">
}
else
{
function is_allnumbers ($text)
{
if( (gettype($text)) == "integer")
{
print "the value is an integer";
return true;
}
$Bad = $this->strip_numbers($text);
if(empty($Bad))
{
print "the value is empty";
return true;
}
return false;
}
function clear_error ()
{
$this->ERROR = "this is an error";
}
function is_phone ($Phone ="")
{
if($this->CLEAR)
{
$this->clear_error();
}
if(empty($Phone))
{
$this->ERROR = "is_phone: No Phone number
submitted";
return false;
}
$Num = $Phone;
$Num = $this->strip_space($Num);
$Num = eregi_replace("(\(|\)|\-|\+)","",$Num);
if(!$this->is_allnumbers($Num))
{
$this->ERROR = "is_phone: bad data in phone
number";
return false;
}
if ( (strlen($Num)) < 7)
{
print "the number is less then 7";
$this->ERROR = "is_phone: number is too short
[$Num][$Phone]";
return false;
}
if( (strlen($Num)) > 13)
{
print "the number is > then 13";
$this->ERROR = "is_phone: number is too long
[$Num][$Phone]";
return false;
}
return true;
}
}
$result = is_phone($Phone);
if($result == "true")
{
echo "success";
}
else
{
echo "failure";
}
</script>
</body>
</html>
The error is
------------
Fatal error: Call to undefined function: is_phone() in
/home/kuruvi1/kishor/public_html/IMS/ADMIN/test/is_phone.php on line 87
Thanks for your tolerance,
- JFK
kishor