Hello everyone
I have a website where I have a contact form and I am not getting the contact form sent to my email

my website is www.rrwills.com
I have attached the contact.php code below for you to examine. I personally scoured the code and could not figure out anything however I am no PHP coder or know much about it unfortunately.

All help is much regarded so thank you in advance for your time and help

<?php

if(!$_POST) exit;

$email = $_POST['email'];


//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
    $error.="Invalid email address entered";
    $errors=1;
}
if($errors==1) echo $error;
else{
    $values = array ('name','email','tel','message');
    $required = array('name','email','tel','message');

    $your_email = "info@redribbonwills.com";
    $email_subject = "New Message: ".$_POST['subject'];
    $email_content = "new message:\n";

    foreach($values as $key => $value){
      if(in_array($value,$required)){
        if ($key != 'subject' && $key != 'name') {
          if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
        }
        $email_content .= $value.': '.$_POST[$value]."\n";
      }
    }

    if(@mail($your_email,$email_subject,$email_content)) {
        echo 'Message sent!'; 
    } else {
        echo 'ERROR!';
    }
}
?>

test your mail() function first perhaps.

ok well I realize it had something to do with the actual email address so i got this to work.. I am now having an issue with displaying the tel when i receive the email.. as seen above i have

$values = array ('name','email','tel','message');
$required = array('name','email','tel','message');

when i use this the form does not send.. when i remove the tel from the $required it sends but does not display on the email! how do I go about this?

i get the response 'PLEASE FILL IN REQUIRED FIELDS'
below is the updated contact.php

<?php

if(!$_POST) exit;

$email = $_POST['email'];


//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
    $error.="Invalid email address entered";
    $errors=1;
}
if($errors==1) echo $error;
else{
    $values = array ('name','email','tel','message');
    $required = array('name','email','tel','message');

    $your_email = "redribbonwills@gmail.com";
    $email_subject = "New Message: ".$_POST['email'];
    $email_content = "new message:\n";

    foreach($values as $key => $value){
      if(in_array($value,$required)){
        if ($key != 'tel' && $key != 'name') {
          if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
        }
        $email_content .= $value.': '.$_POST[$value]."\n";
      }
    }

    if(@mail($your_email,$email_subject,$email_content)) {
        echo 'Message sent!'; 
    } else {
        echo 'ERROR!';
    }
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.