Try putting a closing "?>" php tag just before the final HTML.
Jim
----- Original Message ----- 
From: "J.F.Kishor" <[EMAIL PROTECTED]>
To: "PHP Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 5:26 AM
Subject: [PHP] Error while calling a function


> 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
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to