My form has 5 steps, every steps works fine and session variable pass to each pages. after submission, i want data to emailed back to admin. i have tried to write this, but it returns 500 error or white screen. please correct this where i am wrong here. here below is the codes for email processing after submission.
<?php
session_start();
$email_from = 'no-reply@indianvisaservice.org';//<== update the email address
$email_subject = "New Form submission";
$email_body = "You have received a new message from the user $_SESSION['givenname']."\r\n";.
"Here is the message:\n $message"
$message = Application Reference No - $_SESSION['appid'] ."\r\n";
$message .= type of VISA Application - $_SESSION['visatype']."\r\n";
$message .= Port of Arrival - $_SESSION['arrivalport']."\r\n";
$message .= Application type - $_SESSION['appltype']."\r\n";
$message .= Applicant Name - $_SESSION['givenname']."\r\n";
$message .= Applicant Sex - $_SESSION['applsex']."\r\n";
$message .= Applicant Marital Status - $_SESSION['martstat']."\r\n";
$message .= Applicant Birthdate - $_SESSION['birthdate']."\r\n";
$message .= Applicant Passport No - $_SESSION['passportno']."\r\n";
$message .= Country of Birth - $_SESSION['countrybrth'] ."\r\n";
$message .= Religion of Applicant - $_SESSION['religionxx']."\r\n";
$message .= Educational Qualification - $_SESSION['edu_id']."\r\n";
$message .= Application Nationality by - $_SESSION['nationality_by']."\r\n";
$message .= Passport Issue Place - $_SESSION['issueplace'] ."\r\n";
$message .= Passport Issue date - $_SESSION['issuedate']."\r\n";
$message .= Visual Identification - $_SESSION['visual_d_mark']."\r\n";
$message .= is there Other Passport have - $_SESSION['tab']."\r\n";
$message. = Other Passport No - $_SESSION['oth_ppt_no'] ."\r\n";
$message .= Other Passport Issue Place - $_SESSION['oth_ppt_issue_place']."\r\n";
$message .= Other Passport Issue Date - $_SESSION['previssuedate']."\r\n";
$message .= Other Passport Nationality - $_SESSION['oth_ppt_nationality']."\r\n";
$message .= Other Passport Country Issue - $_SESSION['country_issue'] ."\r\n";
$message .= Father Name - $_SESSION['fthrname']."\r\n";
$message .= Father Nationality - $_SESSION['fathr_nation_id'] ."\r\n";
$message .= Father Previous Nationality - $_SESSION['fthrprevntl']."\r\n";
$message .= Father Place of Birth - $_SESSION['fthrpob']."\r\n";
$message .= Father City of Birth - $_SESSION['fthrcob']."\r\n";
$message .= Mother Name - $_SESSION['mthrname'] ."\r\n";
$message .= Mother Nationality - $_SESSION['mthr_nation_id']."\r\n";
$message .= Mother Previous Nationality - $_SESSION['mthrprevntl']."\r\n";
$message .= Mother Place of Birth - $_SESSION['mthrpob']."\r\n";
$message .= Mother City of Birth - $_SESSION['mthrcob']."\r\n";
$message .= Duration of Visit - $_SESSION['visitduration']."\r\n";
$message .= No of Visa Entry - $_SESSION['visa_entry_id']."\r\n";
$message .= Port of Exit from Country - $_SESSION['exitpointxx']."\r\n";
$message .= Places Likely to be Visit - $_SESSION['placelikelyvisited']."\r\n";
$message .= Places Likely to be Visit2 - $_SESSION['Placelikelyvisited2']."\r\n";
$message .= Do you have Old Visa - $_SESSION['oldvisa']."\r\n";
$message .= Old Visa Number - $_SESSION['old_visa_no']."\r\n";
$message .= Old Visa Type - $_SESSION['old_visa_type_id']."\r\n";
$message .= Old Visa Issue Place - $_SESSION['oldvisaissueplace']."\r\n";
$message .= Permanent Stay - $_SESSION['permStay']."\r\n";
$message. = Refuse Details - $_SESSION['refuse_details']."\r\n";
$message .= Country Visited - $_SESSION['country_visited']."\r\n";
$message .= Name of Referance - $_SESSION['nameofsponsor_ind']."\r\n";
$message .= Referance Address - $_SESSION['referanceaddress']."\r\n";
$message .= Referance City - $_SESSION['referancecity']."\r\n";
$to = "mailme@imgrv.in";//<== update the email address
$headers = "From: $email_from \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers,$message);
//done. redirect to thank-you page.
header('Location: thank-you.html');
?>