Jump to content

PHP form emailing blank


airind

Recommended Posts

I have an almost identical php form running on 2 other websites and they have worked.  However I changed the email and website for my new website and it emails blank.  The subject line comes through, but the email body is completely blank.

I seem to remember having a similar problem the last time but for the life of me can't remember how I fixed it.  It's going to a godaddy email, but I tried to a gmail as well.  I want it going to the godaddy email.

Any help you can provide me will be super appreciated, this is the last step in us accepting online payment and I'm ready to pull my hair out.

 

The form:

---------

 

 
<label> Preferred Email: <input size="30" name="email"></label>
<label class="highlight">Full Mailing Address, including City and Postal: <textarea rows="4" cols="26" name="address"></textarea> </label>
<label>How did you hear about us?<input size="30" name="How_did_you_hear_about_us"> </label> <b> Please select your payment method: </b> <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 highlight padded"><input value="Yes" type="checkbox" 
name=EMT[]> Email Money Transfer (to memberships@apvillage.ca) </div>
<label> Name and email EMT will come from <input size="30" name="emtname"> </label>
<label> Password answer for EMT <input size="30" name="emtpassword"></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:marketing@apvillage.ca">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:memberships@apvillage.ca\r\nReply-to:memberships@apvillage.ca"

if(!mail(
//'memberships@apvillage.ca',
'memberships@apvillage.ca',
'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.apvillage.ca/index.html"><< BACK </a>';
$html_content .= '<br /><br />If this problem persists, please <a href="mailto:marketing@apvillage.ca">let us know</a>. Thanks.';
}
else {
header("location:http://www.apvillage.ca/form_response.htm");
}

?>

<!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.apvillage.ca/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@apvillage.ca">Contact Us</a> </li></ul></div>

<div class="content">

<?php

echo $html_content;

?>

</div>

</div>

<div>

<div id="footer">
<a href="http://www.apvillage.ca/terms.html">Terms & Conditions</a>   •   <a href="mailto:info@apvillage.ca">Contact Us</a>
</div>

</body>
</html></html>

Link to comment
Share on other sites

The plot thickens - I uploaded my php file to my other server and pointed my form there instead, and it works just fine.

It would appear there is something wrong with my hosting account for my new site.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.