zandre88
In Runtime
- Messages
- 241
- Location
- Cincinnati, OH
Hey everyone,
I am having a lot of trouble figuring something out that I'm sure is simple but I can't seem to get figured out.
I have a form set-up on the front page of a website I've been working on. It is from a template package I purchased. Anyways, the problem is I cannot get the content from the form to get sent to my e-mail the way I want it to. It is split into three different .php files. Here are each of them:
I have searched and tried a ton of different options but cannot get it to do what I want. When I fill out the form to test it the only thing I get in the content of the e-mail is the "Message" input. I want everything else included within the content of the e-mail.
If anyone could help me and let me know what I need to do or am doing wrong to accomplish that I'd hugely appreciate it. I know it is broken up somewhat unnecessarily but I think that was to make it easier on the person using the template. However, I just basically took the template as a base and changed a lot of it.
Anyways, any help would be awesome. If you need to see more information please let me know.
Thanks.
I am having a lot of trouble figuring something out that I'm sure is simple but I can't seem to get figured out.
I have a form set-up on the front page of a website I've been working on. It is from a template package I purchased. Anyways, the problem is I cannot get the content from the form to get sent to my e-mail the way I want it to. It is split into three different .php files. Here are each of them:
contacthome.php
PHP:
<?php
/*
Credits: Bit Repository
URL: [url=http://www.bitrepository.com/]Bit Repository | Weekly Web Resources for Programmers and Designers[/url]
*/
include 'config.php';
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if($post)
{
include 'functions.php';
$name = stripslashes($_POST['name']);
$message = stripslashes($_POST['phone']);
$message = trim($_POST['email']);
$message = stripslashes($_POST['address']);
$message = stripslashes($_POST['zip']);
$subject = "Estimate Request";
$message = stripslashes($_POST['message']);
$error = '';
// Check name
if(!$name)
{
$error .= 'Please enter your name.<br />';
}
// Check phone
if(!$phone)
{
$error .= 'Please enter your phone number.<br />';
}
// Check email
if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}
if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}
// Check address
if(!$address)
{
$error .= 'Please enter your address.<br />';
}
// Check zip
if(!$zip)
{
$error .= 'Please enter your zip.<br />';
}
// Check message (length)
if(!$message || strlen($message) < 15)
{
$error .= "Please enter your message. It should have at least 15 characters.<br />";
}
if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());
if($mail)
{
echo 'OK';
}
}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}
}
?>
functions.php
PHP:
<?php
function ValidateEmail($email)
{
/*
(Name) Letters, Numbers, Dots, Hyphens and Underscores
(@ sign)
(Domain) (with possible subdomain(s) ).
Contains only letters, numbers, dots and hyphens (up to 255 characters)
(. sign)
(Extension) Letters only (up to 10 (can be increased in the future) characters)
*/
$regex = '/([a-z0-9_.-]+)'. # name
'@'. # at
'([a-z0-9.-]+){2,255}'. # domain & possibly subdomains
'.'. # period
'([a-z]+){2,10}/i'; # domain extension
if($email == '') {
return false;
}
else {
$eregi = preg_replace($regex, '', $email);
}
return empty($eregi) ? true : false;
}
?>
config.php
PHP:
<?php
// To
define("WEBMASTER_EMAIL", 'myemail@myemail.com');
?>
I have searched and tried a ton of different options but cannot get it to do what I want. When I fill out the form to test it the only thing I get in the content of the e-mail is the "Message" input. I want everything else included within the content of the e-mail.
If anyone could help me and let me know what I need to do or am doing wrong to accomplish that I'd hugely appreciate it. I know it is broken up somewhat unnecessarily but I think that was to make it easier on the person using the template. However, I just basically took the template as a base and changed a lot of it.
Anyways, any help would be awesome. If you need to see more information please let me know.
Thanks.