Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Simple PHP help needed - Contact form (how to send it?)?

Asked Modified Viewed 1,544 times
T
theprod
T
  • Newbie, joined since
  • Contributed 1 post on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
asked
Newbie

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
There are no post found.

Category Forum

Installation Issues - 8

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

T
T
  • Newbie, joined since
  • Contributed 1 post on the community forums.
  • Started 1 thread in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet