PHP Script does not send e-mail
Posted: Sun Aug 29, 2010 11:12 pm
Hey guys,
I'm a novice to the PHP world. I'm working on a web form on my site and I can get the code to post to my database but, i can't get the form e-mailed to me when a client fills it out and submits it. Here's the code
Its weird because i have another table in the database that is somewhat similar to the previous code, except there is less of it and I get responses from the e-mails no problem. Its almost the same coding.
Any help would be appreciated
I'm a novice to the PHP world. I'm working on a web form on my site and I can get the code to post to my database but, i can't get the form e-mailed to me when a client fills it out and submits it. Here's the code
Code: Select all
<?php
ini_set ('display_errors', 1); //Display all errors.
error_reporting (E_ALL & ~ E_NOTICED); //Don't show notices.
// This page receives data from contact_info.htm.
// It will receive: title, name, email, response, comments, and submit.
//Adjust for registered_globals being off.
/* Subject and E-mail Variables */
$email_subject = 'Performance Training Registration';
$email_addresses = 'danieljolivas@gmail.com';
/* Gathers Data Variables */
// General Information
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$phone = $_POST['phone'];
$alt_phone = $_POST['alt_phone'];
$email = $_POST['email'];
// Fitness Information
$gender = $_POST['gender'];
$weight = $_POST['weight'];
$age = $_POST['age'];
$height_ft = $_POST['height_ft'];
$height_in = $_POST['height_in'];
$waist = $_POST['waist'];
$goal = $_POST['goal'];
// Do you belong to a gym?
$membership = $_POST['membership'];
$what_gym = $_POST['what_gym'];
$member_length = $_POST['member_length'];
$days_attend = $_POST['days_attend'];
$join_gym = $_POST['join_gym'];
// Are you an athlete?
$athlete = $_POST['athlete'];
$what_sport = $_POST['what_sport'];
$play_level = $_POST['play_level'];
$improve_what = $_POST['improve_what'];
$improve_other = $_POST['improve_other'];
// Why are you interested in Performance training?
$weight_loss = $_POST['weight_loss'];
$goal_weight = $_POST['goal_weight'];
$strength = $_POST['strength'];
$tone = $_POST['tone'];
$flexibility = $_POST['flexibility'];
$health_reasons = $_POST['health_reasons'];
// What Equipment will you have available (if any)?
$gym_membership = $_POST['gym_membership'];
$medicine_ball = $_POST['medicine_ball'];
$home_gym = $_POST['home_gym'];
$stability_ball = $_POST['stability_ball'];
$agility_ladder = $_POST['agility_ladder'];
$dumbbells = $_POST['dumbbells'];
$equip_other = $_POST['equip_other'];
$other_equipment = $_POST['other_equipment'];
// What is your cardio preference (if any)?
$c_walk = $_POST['c_walk'];
$c_run = $_POST['c_run'];
$c_hike = $_POST['c_hike'];
$c_skate = $_POST['c_skate'];
$c_bike = $_POST['c_bike'];
$c_swim = $_POST['c_swim'];
$c_stairs = $_POST['c_stairs'];
$exercise_history = $_POST['exercise_history'];
$devote_days = $_POST['devote_days'];
$devote_min = $_POST['devote_min'];
//Personal
$race = $_POST['race'];
$sleep = $_POST['sleep'];
// Medical Information
$med_exam = $_POST['med_exam'];
$heart = $_POST['heart'];
$lung = $_POST['lung'];
$digestive = $_POST['digestive'];
$diabetes = $_POST['diabetes'];
$prescriptions = $_POST['prescriptions'];
$drugs = $_POST['drugs'];
$asthma = $_POST['asthma'];
$inhaler_amount = $_POST['inhaler_amount'];
// Dietary Information
$breakfast = $_POST['breakfast'];
$meals = $_POST['meals'];
$fruit_veg = $_POST['fruit_veg'];
$fats = $_POST['fats'];
$processed_food = $_POST['processed_food'];
$alcohol = $_POST['alcohol'];
// Psychological Information
$happiness = $_POST['happiness'];
$depression = $_POST['depression'];
$anxiety = $_POST['anxiety'];
$relaxation = $_POST['relaxation'];
$marriage = $_POST['marriage'];
$job = $_POST['job'];
$comments = $_POST['comments'];
// PT Package Types
$high_school_training = $_POST['high_school_training'];
$target_training = $_POST['target_training'];
$pt1_training = $_POST['pt1_training'];
$professional_training = $_POST['professional_training'];
$elite_training = $_POST['elite_training'];
$body = <<<EOD
<br><hr><br>
<strong> General Information </strong>
First Name: $first_name <br>
Last Name: $last_name <br>
Address: $address <br>
City: $city <br>
State: $state <br>
Zip: $zip <br>
Country: $country <br>
Phone: $phone <br>
Alt. Phone: $alt_phone <br>
Email: $email <br>
<br>
<strong>Fitness Information</strong>
<br>
Gender: $gender <br>
Weight: $weight <br>
Age: $age <br>
Height ft: $height_ft <br>
Height in: $height_in <br>
Waist: $waist <br>
Goal: $goal <br>
<br>
<strong>Do you belong to a gym?</strong>
<br>
What Gym: $what_gym <br>
Member Length: $member_length <br>
Days Attend: $days_attend <br>
Are You Willing to Join a Gym?: $join_gym <br>
<br>
<strong>Are you an athlete?</strong>
<br>
What Sport: $what_sport <br>
Play Level: $play_level <br>
Improve What: $improve_what <br>
Improve Other: $improve_other <br>
<br>
<strong>Why are you interested in Performance Training?</strong>
Weight Loss: $weight_loss <br>
Goal Weight: $goal_weight <br>
Strength: $strength <br>
Tone: $tone <br>
Flexibility: $flexibility <br>
Health Reasons: $health_reasons <br>
<br>
<strong>What equipment will you have available (If any)?</strong>
<br>
Gym Membership: $gym_membership <br>
Medicine Ball: $medicine_ball <br>
Home Gym: $home_gym <br>
Stability Ball: $stability_ball <br>
Agility Ladder: $agility_ladder <br>
Weights/dumbbells: $dumbbells <br>
Other: $equip_other <br>
Other Equipment: $other_equipment <br>
<br>
<strong>What is your cardio preference (if any)?</strong>
<br>
Walk: $c_walk<br>
Run: $c_run <br>
Hike: $c_hike <br>
Skate: $c_skate <br>
Bike: $c_bike <br>
Swim: $c_swim <br>
Stairs: $c_stairs <br>
<br>
<strong>Performance Training package</strong>
<br>
High School Package: $high_school_training <br>
Target Training Package: $target_training <br>
PT1 Training Package: $pt1_training <br>
Professional Package: $professional_training <br>
Elite Training Package: $elite_training <br>
<br>
<strong>Fitness Schedule</strong>
<br>
How Active Are you?: $exercise_history <br>
Devote Days: $devote_days <br>
Devote Min: $devote_min <br>
<br>
<strong>Personal Information</strong>
<br>
Race: $race <br>
Sleep: $sleep <br>
<br>
<strong>Medical Information</strong>
<br>
Medical Exams: $med_exam <br>
Heart: $heart <br>
Lung: $lung <br>
Digestive: $digestive <br>
Diabetes: $diabetes <br>
Drugs: $drugs <br>
Prescriptions: $prescriptions <br>
Asthma: $asthma <br>
Inhaler Amount: $inhaler_amount <br>
<br>
<strong>Dietary Information</strong>
<br>
Breakfast: $breakfast <br>
Meals: $meals <br>
Fruit and Vegetables: $fruit_veg <br>
Fats: $fats <br>
Processed Food: $processed_food <br>
Alcohol: $alcohol <br>
<br>
<strong>Psychological Information</strong>
<br>
Happiness: $happiness <br>
Depression: $depression <br>
Anxiety: $anxiety <br>
Relaxation: $relaxation <br>
Marriage: $marriage <br>
Job: $job <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($email_addresses, $email_subject, $body, $headers);
Code: Select all
<?php
ini_set ('display_errors', 1); //Display all errors.
error_reporting (E_ALL & ~ E_NOTICED); //Don't show notices.
// This page receives data from contact_info.htm.
// It will receive: name, phone, email, address, city, and submit.
//Adjust for registered_globals being off.
$email_subject = 'Performance Training Contact';
$email_addresses = 'danieljolivas@gmail.com';
//Tell Us More
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$phone = $_POST['phone'];
$phone_type_1 = $_POST['phone_type_1'];
$alt_phone = $_POST['alt_phone'];
$phone_type_2 = $_POST['phone_type_2'];
$occupation = $_POST['occupation'];
$email = $_POST['email'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$referral = $_POST['referral'];
//Who Am I
$fitness = $_POST['fitness'];
$sport = $_POST['sport'];
$level = $_POST['level'];
$contact = $_POST['contact'];
$comments = $_POST['comments'];
$body = <<<EOD
<br><hr><br>
<strong>Tell Us More</strong> <br>
<br>
First Name: $first_name <br>
Last Name: $last_name <br>
Phone: $phone <br>
Phone Type: $phone_type_1 <br>
Alt. Phone: $alt_phone <br>
Phone Type: $phone_type_2 <br>
Occupation: $occupation <br>
Email: $email <br>
Address: $address <br>
City: $city <br>
Zip: $zip <br>
State: $state <br>
Country: $country <br>
Referral: $referral <br>
<br>
<strong>Who am I</strong> <br>
<br>
I Am A/An: $fitness <br>
My Sport Is: $sport<br>
Team/Level Preparing For: $level <br>
Contact Me By: $contact <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($email_addresses, $email_subject, $body, $headers);