BroChris
02-02-2007, 03:20 PM
I can't get my form on this page (http://www.parklandbaptistchurch.org/contact.html) to actually send email.
<?php
if(($_GET['action'])=='send'){
$message=$_POST['message'];
if(($message != "") && ($message != 'Message')){
$realname=$_POST['realname'];
if($realname!=''){$postrealname='Name: ' . $realname . "\n";};
$email=$_POST['email'];
if(($email!='') && (ereg('@',$email))) {$postemail='Email: ' . $email . "\n";};
$message = stripslashes($message);
$to=$_POST['to'];
if($to=='pastor'){
$to='pastor's email address';
}
elseif($to=='associate'){
$to='associate minister's email address';
}
elseif($to=='youth'){
$to='youth minister's email address';
}
else{
$to='my email address';
}
$subject = "from parklandbaptistchurch.org";
$message=$message . "\n" . $postrealname . $postemail;
$headers = "From: " . $realname . " <" . $email . ">\r\n";
mail($to, $subject, $message, $headers);
echo '<p>Your message has been sent.</p>';
}
}
else { ?>
<h2>Contact Us</h2>
<p><strong>Parkland Baptist Church</strong><br />
7206 Shepherdsville Rd., Louisville, Kentucky 40219, United States<br />
Phone: 502-969-1387<br />
Fax: 502-969-1388</p>
<form action="contact.html?action=send" method="post">
<fieldset>
<legend>E-mail form</legend>
<label for="name">Name:</label><input type="text" id="name" name="realname" value="Name" onfocus="clearDefault(this)" onblur="insertDefault(this)" class="form" />
<label for="email">Email:</label><input type="text" id="email" name="email" value="Email Address" onfocus="clearDefault(this)" onblur="insertDefault(this)" class="form" />
<label for="to">Who would you like to contact?</label><select><option value="pastor">Pastor Tom Curry</option><option value="associate">Associate Minister Todd Beasley</option><option value="youth">Youth Minister Beth Turpin</option><option value="web">Web Developer Chris Huff</option></select>
<label for="message">Message:</label><textarea id="message" name="message" rows="3" cols="25" onfocus="clearDefault(this)" onblur="insertDefault(this)" class="form">Message</textarea>
<p><em>* All fields are required</em></p>
<input type="submit" value="send" class="submit" /> <input type="reset" class="submit" value="clear" />
</fieldset>
</form>
<?php } ?>
Here's my phpinfo (http://www.parklandbaptistchurch.org/phpinfo.php) if that's helpful. I noticed that I doesn't have a MAIL or _ENV["MAIL"] variable like other domains that I have. Is this the problem? If so, how do I add it?
<?php
if(($_GET['action'])=='send'){
$message=$_POST['message'];
if(($message != "") && ($message != 'Message')){
$realname=$_POST['realname'];
if($realname!=''){$postrealname='Name: ' . $realname . "\n";};
$email=$_POST['email'];
if(($email!='') && (ereg('@',$email))) {$postemail='Email: ' . $email . "\n";};
$message = stripslashes($message);
$to=$_POST['to'];
if($to=='pastor'){
$to='pastor's email address';
}
elseif($to=='associate'){
$to='associate minister's email address';
}
elseif($to=='youth'){
$to='youth minister's email address';
}
else{
$to='my email address';
}
$subject = "from parklandbaptistchurch.org";
$message=$message . "\n" . $postrealname . $postemail;
$headers = "From: " . $realname . " <" . $email . ">\r\n";
mail($to, $subject, $message, $headers);
echo '<p>Your message has been sent.</p>';
}
}
else { ?>
<h2>Contact Us</h2>
<p><strong>Parkland Baptist Church</strong><br />
7206 Shepherdsville Rd., Louisville, Kentucky 40219, United States<br />
Phone: 502-969-1387<br />
Fax: 502-969-1388</p>
<form action="contact.html?action=send" method="post">
<fieldset>
<legend>E-mail form</legend>
<label for="name">Name:</label><input type="text" id="name" name="realname" value="Name" onfocus="clearDefault(this)" onblur="insertDefault(this)" class="form" />
<label for="email">Email:</label><input type="text" id="email" name="email" value="Email Address" onfocus="clearDefault(this)" onblur="insertDefault(this)" class="form" />
<label for="to">Who would you like to contact?</label><select><option value="pastor">Pastor Tom Curry</option><option value="associate">Associate Minister Todd Beasley</option><option value="youth">Youth Minister Beth Turpin</option><option value="web">Web Developer Chris Huff</option></select>
<label for="message">Message:</label><textarea id="message" name="message" rows="3" cols="25" onfocus="clearDefault(this)" onblur="insertDefault(this)" class="form">Message</textarea>
<p><em>* All fields are required</em></p>
<input type="submit" value="send" class="submit" /> <input type="reset" class="submit" value="clear" />
</fieldset>
</form>
<?php } ?>
Here's my phpinfo (http://www.parklandbaptistchurch.org/phpinfo.php) if that's helpful. I noticed that I doesn't have a MAIL or _ENV["MAIL"] variable like other domains that I have. Is this the problem? If so, how do I add it?