I have used this form template and php template in the past with success, but I tried adapting it today and although it will email me, the email is completely blank. I'm hoping you can help me identify why this is.
The form:
<form onsubmit="return validate();" method="post" name="membership_form"
action=http://www.apvcalgary.com/membership_form.php><!--
<input name="event" size="30" type="hidden" value="Membership" />
--><label>Membership: <select name="Event"> <option selected
value=oneyear>One Year Membership with APVCS</option></select></label><label class="highlight">Legal Name: <input size="30"
name=legalname> </label><label>Name that appears on Facebook (leave blank if the same): <input size="30" name="fbname"> </label><label
class=highlight> Preferred Email: <input size="30" name="email"> </label><label>How did you
hear about us?<input size="30" name="How_did_you_hear_about_us"> </label> Please select your payment method: <br>
<div class="radio_checkbox highlight padded"><input value="Yes" type="checkbox"
name=Paypal[]> Paypal (you do not need a pp account to pay by credit card with them) </div> <label> Name Or Company associated with your PP account if applicable <input size="30" name="ppname"> </label> <div class="radio_checkbox padded"><input value="Yes" type="checkbox"
name=EMT[]> Email Money Transfer (to apvillage@gmail.com) </div> <label> Name and email EMT will come from <input size="30" name="emtname"> </label><!--<div class="radio_checkbox highlight padded">
Radio Buttons:<br />
<label>yes <input name="radio_buttons" value="yes" type="radio" /></label>
<label>no <input name="radio_buttons" value="no" type="radio" /></label>
</div>
<div class="radio_checkbox padded">
Check Boxes:<br /> --><!-- If using checkboxes be sure to include square brackets (ex. name="meal_selections[]") at the end of the name attribute --><!--<label>yes <input name="checkboxes[]" value="yes" type="checkbox" /></label>
<label>no <input name="checkboxes[]" value="no" type="checkbox" /></label>
</div>
<label class="highlight">-->
<div class="radio_checkbox padded"><!-- If using checkboxes be sure to include square brackets (ex. name="meal_selections[]") at the end of the name attribute --><input
value=Yes type=checkbox name=Terms> I understand how <a
href="#member" target=_blank> membership </a> works, and the expiration period (required for membership)</div><label
class=highlight>Questions/Comments: <textarea rows="4" cols="26" name="comments"></textarea> </label>
<div class="submit"><input value="submit" type="submit" name="submit_button">
</div></form>
The PHP:
<?php
function filter($input){
$to_remove = array('~','`','{','}','^','[',']','<script>','</script>','<applet>','</applet>');
$clean = trim(str_replace($to_remove, "-", $input));
return $clean;
}
function cleanup_text_for_display($txt){
$txt = str_replace('_',' ',$txt);
$txt = ucwords($txt);
//$txt = str_replace(' ',' ',$txt);
return $txt;
}
if(isset($_POST) && !empty($_POST)){
$mail_content = "MEMBERSHIP FORM\r\n";
$mail_content .= "-------------------------------\r\n";
date_default_timezone_set('MST');
$mail_content .= date('F j, Y, g:i a')."\r\n";
$html_content = '<h2>Thank you for becoming a member!</h2>';
$html_content .= '<p>If there are any errors in the information below <a href="mailto:info@apvcalgary.com">please let us know</a>.</p>';
foreach($_POST as $key => $value){
if(is_array($value)){
$mail_content .= cleanup_text_for_display($key).': ';
foreach($value as $item){
$mail_content .= $item." ";
}
$mail_content .= "\r\n";
}else{
if($key == 'submit_button')
continue;
// build email content
$mail_content .= cleanup_text_for_display($key).': '.$value."\r\n";
// layout form data for display in web page
$html_content .= '<p>'.cleanup_text_for_display($key).': '.$value.'</p>';
}
}
}
//,"From:apvillage@gmail.com\r\nReply-to:apvillage@gmail.com"
if(!mail(
//'apvillage@gmail.com,
'apvillage@gmail.com',
'Membership Form',
$mail_content
)){
$html_content = '<h3>ERROR: Sorry, this message could not be sent.</h3>';
$html_content .= 'Please try resubmitting the form.<br /><a href="http://www.apvcalgary.com/index.html"><< BACK </a>';
$html_content .= '<br /><br />If this problem persists, please <a href="mailto:info@apvcalgary.com">let us know</a>. Thanks.';
}
else {
header("location:http://www.apvcalgary.com/form_response.html");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html><head><title>AP Village | Calgary</title>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link
rel=stylesheet type=text/css href="http://www.apvcalgary.com/styles.css">
<meta name="GENERATOR" content="MSHTML 8.00.6001.19170">
</head>
<body>
<div id="leftSideBar">
<div id="apvcImg">
<div id="top_text">
</div>
<div class="nav">
<ul>
<li><a href="index.html">Home </a>
<li><a href="about.htm">About Us</a>
<li><a href="events.htm">Upcoming Events</a>
<li><a href="outdoorplay.htm">Summer Playgroup </a>
<li><a href="indoorplay.htm">Winter Playgroup</a>
<li><a href="member.htm">Become A Member</a>
<li><a href="lendinglibrary.htm">Carrier Lending Library</a>
<li><a href="faq.htm">FAQ</a>
<li><a href="links.htm">Links</a>
<li><a href="mailto:info@apvcalgary.com">Contact Us</a> </li></ul></div>
<div class="content">
<?php
echo $html_content;
?>
</div>
</div>
<div>
<div id="footer">
<a href="http://www.apvcalgary.com/terms.html">Terms & Conditions</a> • <a href="mailto:info@apvcalgary.com">Contact Us</a>
</div>
</body>
</html></html>