I am a newbie at PHP coding and am trying to generate formatted output in an e-mail message. I collect info from a form at: http://www.pinesofsarasota.org/emp_app.htm. I first echo the collected info back to the user and send this same info by e-mail (see code at the bottom) to a designated person. In the code, I am using my e-mail address. The php code is as follows:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<?php error_reporting(E_ALL); ?>
<?php
$tab2=" ";
$tab4=" ";
$tab8="{$tab4}{$tab4}";
echo "<p>Date of application: <b>$POST[date]</b></p>";
echo "Thank you, <b>$POST[first_name] $POST[middle_initial] $POST[last_name]</b> for your interest in Pines of Sarasota<br>";
echo "You have entered the following information:<p>";
echo "Address: <b> $POST[street_name]</b><br>";
echo "{$tab8}{$tab4}{$tab2}<b>$POST[city], $POST[state] $POST[zip_code]</b><br>";
echo "Social Security Number: <b> $POST[social_security_number]</b><br>";
echo "Phone Number: <b> $POST[phone_number]</b><br>";
echo "How long have you lived at this address? <b> $POST[time_lived_at_this_address]</b><br>";
echo "Are you at least 18 years of age? <b> $POST[18_years]</b><br>";
echo "If no, please state your age: <b> $POST[age]</b><br>";
echo "Are you legally eligible for employment in the US? <b> $POST[legal_employment]</b><br>";
?>
<p><font color="red"><H2>Employment Information</H2></font></p>
<?php
echo "Position applying for: <b> $POST[position_applying_for]</b><br>";
echo "Date able to start: <b> $POST[date_able_to_start]</b><br>";
echo "Referred by: <b> $POST[referred_by]</b><br>";
echo "Type of employment desired: <b> $POST[employment_type]</b><br>";
echo "Salary desired: <b> $POST[starting_salary]</b><br>";
echo "Are you willing to work overtime? <b> $POST[overtime]</b><br>";
echo "Are there any shifts or hours that you cannot work? <b> $POST[shift_preference]</b><br>";
echo "If yes, please identify: <b> $POST[undesirable_shifts]</b><br>";
echo "Are you able and willing to perform job related functions with or without reasonable accommodation? <b> $POST[perform_job_related_functions]</b><br>";
echo "Have you ever applied for a position with Pineas of Sarasota before? <b> $POST[applied_previously]</b><br>";
echo "If yes, when? <b> $POST[when_applied_previously_to_pines]</b><br>";
echo "Have you ever been convicted of any crime other than a minor traffic violation? <b> $POST[crime_conviction]</b><br>";
echo "If yes, state the date and places where the charges occurred (Note: Answering yes will not automatically disqualify you for employment): <b> $POST[date_and_places_charged]</b><br>";
echo "Are you presently employed? <b> $POST[presently_employed]</b><br>";
echo "If yes, may we contact your present employer? <b> $POST[contact_employer]</b><br>";
echo "In the event of an emergency, notify:<b> $POST[emergency_contact_name]</b><br>";
echo "Telephone: <b>$POST[emergency_contact_phone]</b><br>";
echo "Address: <b> $POST[emergency_contact_address]</b><br>";
echo "Relationship: <b> $_POST[emergency_contact_relationship]</b><br>";
?>
<H2><font color="red">Education</font></H2><p>
<?php
echo "High School: <b> $POST[high_school]</b><br>";
echo "Years completed: <b> $POST[years_completed_high_school]</b><br>";
echo "Graduate? <B> $POST[graduate_high_school]</b><br>";
echo "Degree earned: <b> $POST[degree_earned_major]</b><p>";
//
echo "College: <b> $POST[college]</b><br>";
echo "Years completed: <b> $POST[years_completed_college]</b><br>";
echo "Graduate? <b> $POST[graduate_college]</b><br>";
echo "Degree earned: <b> $POST[degree_earned_major1]</b><p>";
//
echo "Graduate school: <b> $POST[graduate_school]</b><br>";
echo "Years completed: <b> $POST[years_completed_graduate_school]</b><br>";
echo "Graduate? <b> $POST[graduate_graduate_school]</b><br>";
echo "Degree earned: <b> $POST[degree_earned_major2]</b><p>";
//
echo "Correspondence school: <b> $POST[other_school]</b><br>";
echo "Years completed: <b> $POST[years_completed_other_schools]</b><br>";
echo "Graduate? <b> $POST[extra_schooling]</b><br>";
echo "Degree earned: <b> $POST[degree_earned_major3]</b><br>";
//
echo "Listing any extracurricular activities, award, scholarships, or clubs that you were involved in <br>
which might be related to the position for which you are applying: <b> $_POST[listing_of_any_other_activities_awards_etc]</b><br>";
//
?>
<H2><font color="red">Employment Experience</font></H2><p>
<?php
echo "Company Name: <b> $POST[company_name_one]</b><br>";
echo "Telephone: <b> $POST[business_telephone_one]</b><br>";
echo "Address: <b> $POST[business_address_one]</b><br>";
echo "Employed from: <b> $POST[employed_from_one]</b><br>";
echo "Employed to: <b> $POST[employed_to_one]</b><br>";
echo "Supervisor: <b> $POST[supervisor_name_one]</b><br>";
echo "Salary/Wages Start: <b> $POST[starting_wages_one]</b><br>";
echo "Sarary/Wages Finish: <b> $POST[finish_wages_one]</b><br>";
echo "State job title and responsibilities: <b> $POST[job_title_one]</b><br>";
echo "Reason for separation: <b> $POST[reason_for_separation_one]</b><p>";
//
echo "Company Name: <b> $POST[company_name_two]</b><br>";
echo "Telephone: <b> $POST[business_telephone_two]</b><br>";
echo "Address: <b> $POST[business_address_two]</b><br>";
echo "Employed from: <b> $POST[employed_from_two]</b><br>";
echo "Employed to: <b> $POST[employed_to_two]</b><br>";
echo "Supervisor: <b> $POST[supervisor_name_two]</b><br>";
echo "Salary/Wages Start: <b> $POST[starting_wages_two]</b><br>";
echo "Sarary/Wages Finish: <b> $POST[finish_wages_two]</b><br>";
echo "State job title and responsibilities: <b> $POST[job_title_two]</b><br>";
echo "Reason for separation: <b> $POST[reason_for_separation_two]</b><p>";
//
echo "Company Name: <b> $POST[company_name_three]</b><br>";
echo "Telephone: <b> $POST[business_telephone_three]</b><br>";
echo "Address: <b> $POST[business_address_three]</b><br>";
echo "Employed from: <b> $POST[employed_from_three]</b><br>";
echo "Employed to: <b> $POST[employed_to_three]</b><br>";
echo "Supervisor: <b> $POST[supervisor_name_three]</b><br>";
echo "Salary/Wages Start: <b> $POST[starting_wages_three]</b><br>";
echo "Sarary/Wages Finish: <b> $POST[finish_wages_three]</b><br>";
echo "State job title and responsibilities: <b> $POST[job_title_three]</b><br>";
echo "Reason for separation: <b> $POST[reason_for_separation_three]</b><p>";
//
echo "Company Name: <b> $POST[company_name_four]</b><br>";
echo "Telephone: <b> $POST[business_telephone_four]</b><br>";
echo "Address: <b> $POST[business_address_four]</b><br>";
echo "Employed from: <b> $POST[employed_from_four]</b><br>";
echo "Employed to: <b> $POST[employed_to_four]</b><br>";
echo "Supervisor: <b> $POST[supervisor_name_four]</b><br>";
echo "Salary/Wages Start: <b> $POST[starting_wages_four]</b><br>";
echo "Sarary/Wages Finish: <b> $POST[finish_wages_four]</b><br>";
echo "State job title and responsibilities: <b> $POST[job_title_four]</b><br>";
echo "Reason for separation: <b> $POST[reason_for_separation_four]</b><br>";
//
echo "Note that all the employers listed above will be contacted unless the applicant indicates differently. <br>
Are there any employers above whom you do not wish for us to contact? <b> $POST[contact_employer]</b><br>";
echo "If yes, please indicate employer and reason: <b> $_POST[reason_not_to_contact_employer]</b><br>";
?>
<H2><font color="red">References</font></H2><p>
<?php
echo "List below the names of three persons, not related to you, whom you have known for at least one year.<br>";
echo "Name: <b> $POST[reference_name_one]</b><br>";
echo "Address: <b> $POST[reference_address_and_phone_one]</b><br>";
echo "Business: <b> $POST[reference_business_one]</b><br>";
echo "Years Known: <b> $POST[reference_years_known_one]</b><p>";
//
echo "Name: <b> $POST[reference_name_two]</b><br>";
echo "Address: <b> $POST[reference_address_and_phone_two]</b><br>";
echo "Business: <b> $POST[reference_business_two]</b><br>";
echo "Years Known: <b> $POST[reference_years_known_two]</b><p>";
//
echo "Name: <b> $POST[reference_name_three]</b><br>";
echo "Address: <b> $POST[reference_address_and_phone_three]</b><br>";
echo "Business: <b> $POST[reference_business_three]</b><br>";
echo "Years Known: <b> $POST[reference_years_known_three]</b><p>";
//
?>
<?php
//start building the mail string
$msg = "Date: $POST[date]\n";
$msg .= "Name: $POST[first_name] $POST[middle_initial] $POST[last_name]\n";
$msg .= "Address: $POST[street_name]\n";
$msg .= "$POST[city], $POST[state] $POST[zip_code]\n\n";
//set up the mail
$recipient = "dschofield@pinesofsarasota.org";
$subject = "Form Submission Results";
$mailheaders = " ";
//
mail($recipient, $subject, $msg, $mailheaders);
?>
</body>
</html>
The mail message part uses the variable"$msg" to generate the e-mail content. I need to be able to generate "white space" at some points to make the e-mail more readable. Do you know any slick tricks for formatting this variable's output?
Thank you