Hi there,
A friend has downloaded a web template, and has a smart looking contact form on his page.
In the template came contact.php file, which contains the following:
<?php
if(!$_POST) exit;
$email = $_POST ['email'];
$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+… $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+… ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\… )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','phone','concerning','me…
$required = array('name','email','message');
$your_email = "james@example.com";
$email_subject = "New Message";
$email_content = "new message:\n";
//for( $i = 0 ; $i < count( $values ) ; ++$i ) {
// for( $c = 0 ; $c < count( $required ) ; ++$c ) {
// if( $values[$i]==$required[$c] ) {
// echo $required[$x];
// if( empty($_POST[$values[$i]]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
// }
// }
// $email_content .= $values[$i].': '.$_POST[$values[$i]]."\n";
//}
foreach($values as $value){
if(in_array($value,$required)){
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
if(mail($your_email,$email_subject,$em… {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>
______________________________________
What would be needed to make the form work, and send it to a certain email address?
Thanks!
0 replies