The form action="<?php echo $_SERVER['PHP_SELF'];?>

yet the form when sent presents a Oops page! Page not found in lieu of the "Your message has been sent"

The form handler is as follows:

PHP Code:
<?php
define
("EMAIL""xxxxxx@gmail.com");

$messageErr "";
$message_text "";
$errors "";

$nameErr "";
$emailErr "";
$phoneErr "";
$messageErr "";
$codeErr "";

$name "";
$email "";
$phone "";
$message "";
$code "";

if(isset(
$_POST['submit'])) {
 
  include(
'validateClass.php');
 
  
//assign post data to variables
    
$name    trim($_POST['name']);
    
$email   trim($_POST['email']);
    
$phone   trim($_POST['phone']);
    
$message trim($_POST['message']);
    
$code    trim($_POST['code']);
 
  
//start validating our form
  
$v = new validate();
  
$v->validateStr($name"name"375);
  
$v->validateEmail($email"email");
  
$v->validatePhone($phone"phone");
  
$v->validateStr($message"message"10500); 
  
$v->validateCode($code"code");
 
  if(!
$v->hasErrors()) {
        
$header   "From: $email\n" "Reply-To: $email\n";
        
$subject  "Contact Form Subject";
        
$email_to EMAIL;
 
        
$emailMessage  "Name:    " $name  "\n";
        
$emailMessage .= "Email:   " $email "\n";
        
$emailMessage .= "Phone:   " $phone "\n\n";
        
$emailMessage .= "Message: " $message
   
      
//use php's mail function to send the email
        
@mail($email_to$subject ,$emailMessage ,$header ); 
               
      
//grab the current url, append ?sent=yes to it and then redirect to that url 
       
$url "http". ((!empty($_SERVER['HTTPS'])) ? "s" "") . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];       
       
header('Location: '.$url."?sent=yes");
      
    } else {
    
//set the number of errors message
    
$message_text $v->errorNumMessage();      
 
    
//store the errors list in a variable
    
$errors $v->displayErrors();
 
    
//get the individual error messages
    
$nameErr    $v->getError("name");
    
$emailErr   $v->getError("email");
    
$phoneErr   $v->getError("phone");
    
$messageErr $v->getError("message");
    
$codeErr    $v->getError("code");
  } 
//end of the error check
}
// end isset
?>
and the "Your message has been sent" is built in at the top of the form is as follows:

PHP Code:
<?php if(isset($_POST['sent'])): ?><h2>Your message has been sent</h2><?php endif; ?>
Why is the process sending to the Oops page ?