$urinary = $_POST['urinary'];
$nervous = $_POST['nervous'];
$muscle = $_POST['muscle'];
$eye = $_POST['eye'];
$ear = $_POST['ear'];
$tropical = $_POST['tropical'];
$otherproblems = $_POST['otherproblems'];
$medicalMore = $_POST['extraInfoArea'];
$diet = $_POST['diet'];
$diet_other = $_POST['diet-other'];
$clinicaltrial2 = $_POST['clinicaltrial2'];
$newsletter = $_POST['newsletter'];
//Validate first
$email_from = '*****@*****.**';
//<== update the email address
$email_subject = "Full Application Form Submission";
$email_body = "\nA new applicant has submitted their details:\n\nStudy code: {$trial}\n\nWhere did you hear about us?: {$hear}, {$hearother}, {$hearrec}\n\n----------------------------------- Step 1: Introduction --------------------------------------------\n\nName: {$salutation} {$firstname} {$middlename} {$lastname}\nGender: {$gender} " . ($gender != "Male" ? " Are you pregnant & lactating?: {$pregnant}" : "") . "\nDate of birth: {$dateofbirth}\nAddress: {$address1}, {$address2}, {$town}, {$city}, {$postcode}\nEmail address: {$emailaddress}\nTelephone number: {$contactnumber}\nJob status: {$jobstatus}\nOccupation: {$occupation}\nEthnic origin: {$ethnicorigin}\nPassport No.: {$passport}\nNational Insurance No.: {$ni}\n\n------------------------------------- Step 2: Personal Details ----------------------------------------\n\nHeight in cm: {$heightcm}\nWeight in KG: {$weightkg}\nHeight in Feet / Inches: {$heightfeet} / {$heightinches}\nWeight in Stone / Pounds: {$weightstones} / {$weightpounds}\nBMI: {$feetbmi} {$metresbmi}\n\nDo you smoke?: " . ($smokeamount > 0 && $smokeamount != 6 ? "Yes " : "No ") . ($smokeamount == 6 ? "Quit less than 6 months ago " : ($smokeamount == 0 ? "Never or quit more than 6 months ago " : ($smokemount > 0 ? "how many?: " : $smokeamount))) . " {$smokeamountother}\nDo you drink alcohol?: {$alcohol} " . ($alcohol == "Yes" ? " how many units do you drink per week?: {$unitsperweek}" : "") . "\nHave you any specific dietary requirements?: {$diet}\nAre you happy to undergo a urine test to check for non-medical drugs?: {$urinetest}\n\n------------------------------------- Step 3 / Step 4: Medical Assessment ----------------------------------------\n\nAre you able to have children?: " . $children . "\n" . (!children == "No" ? "\nCan you tell us the reason you cannot have children?: {$why_children} {$why_children_other}\n" : "") . "\nDo you currently use contraception?: " . ($contraception ? "Yes" : "No") . "\n" . ($contraception ? "\nCan you tell us which form of contraception you use?: {$which_contraception} {$which_contraception_other}\n" : "") . "\nHave you been registered with a GP in the UK for over 12 months?: " . ($surgery ? "Yes" : "No") . "\n\nAre you taking any prescribed or over the counter medication?: {$medication} " . ($medication != 'No' ? " - {$namemedication}\nHow often do you take it?: {$usemedication}" : "") . "\n\nAre you suffering from any allergies?: {$allergies}" . ($allergies != 'No' ? "\n\nIf yes, please tell us which allergies you have: {$whichallergies}\n\nDo you take medication to alleviate allergic symptoms?: {$allergies_med}\n" . ($allergies_med ? "If yes, please specify: {$allergies_med_details}" : "") . "" : "") . "\n\nHave you had any operations?: {$anyoperations}" . ($anyoperations != 'No' ? " \nIf yes, please specify: {$operation}  Date (month/year if known): {$operationdate}" : "") . "\n\nHave you had / are you suffering from:\n\nAsthma problems?: {$asthma}" . ($asthma != 'No' ? "\n\n  If yes...How long have you suffered with Asthma?: {$howlongasthma}\n  Age of diagnosis: {$ageasthma}\n  Are you currently taking asthma medication?: {$asthma_medication}\n  Name of asthma medication: {$asthma_medication_details}\n  Do you attend an asthma clinic at your GP surgery?: {$asthma_clinic}\n  How often do you attend?: {$asthma_clinic_details}\n  " : "") . "\n\nHave you been diagnosed with diabetes?: {$diabetes}" . ($diabetes == 'Yes' ? "\n  If yes, which type?: {$diabetestype}\n  If Type II, how is your diabetes controlled?: {$diabetes_input}\n  " : "") . "\n\nHave you had / are you suffering from:\n\nLiver problems?: {$liver}\n\nSkin problems?: {$skin}" . ($skin != 'No' ? " \n  If yes, details: {$skindetails} {$skindetails2}\n  " : "") . "\nHeart problems?: {$heart}\n\nStomach / bowel problems?: {$stomach}\n \nMigraines?: {$migraines}\n\nUrinary (including kidney) problems?: {$urinary}\n\nNervous system problems?: {$nervous}\n\nMuscle / bone / joint problems?: {$muscle}\n\nEye problems? e.g. glaucoma, retinal detachment etc: {$eye}\n\nEar / throat / nose problems?: {$ear}\n\nTropical disease? e.g. malaria: {$tropical}\n\nAny other problems not included above?: {$otherproblems}\n\n\nIf Yes to any of the above please give more info: {$medicalMore}\n\n--------------------------------------------------------------------------------------------------------- \n\nWould you like to sign up to our study alerts?: " . ($newsletter ? "Yes" : "No") . "\n\n";
$to = "nottingham@quotientclinical.com,enquiries@awardmarketing.co.uk,sarah@awardmarketing.co.uk";
//$to = "*****@*****.**";
//<== update the email address
$headers = "From: QUOTIENT CLINICAL Website Form \r\n";
$headers .= "Reply-To: {$email}\r\n";
//Send the email!
// this executes from the live site!
mail($to, $email_subject, $email_body, $headers);
/// Send the HTML email to the user
include 'drupal_send.php';
include 'sendemail.php';
SendHTMLEMail(2, $emailaddress, $email_from, $email_subject, "Dear", $salutation, $lastname);
//done. redirect to thank-you page.
header('Location: /full-application-thank-you/');
if (!isset($_POST['Submit'])) {
    //This page should not be accessed directly. Need to submit the form.
    echo "error; you need to submit the form!";
}
$trial = $_POST['clinicaltrial'];
$dateofbirth = $_POST['dob'];
$salutation = $_POST['title'];
$firstname = $_POST['firstname'];
$middlename = $_POST['middlename'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$volnumber = $_POST['volnumber'];
//Validate first
$email_from = '*****@*****.**';
//<== update the email address
$email_subject = "Existing Volunteer Form submission - Study: {$trial}";
$email_body = "\nAn existing volunteer has submitted their details for new trial:\n\nStudy code: {$trial}\n\nName: {$salutation} {$firstname} {$middlename} {$lastname}\n\nDate of birth: {$dateofbirth}\n\nVolunteer Number: {$volnumber}\n\nEmail address: {$email}\n\n\n";
$to = "nottingham@quotientclinical.com,enquiries@awardmarketing.co.uk,webmaster@weneedyou.co.uk";
//<== update the email address
//$to = "*****@*****.**";//<== update the email address
$headers = "From: QUOTIENT CLINICAL Website Form <*****@*****.**> \r\n";
$headers .= "Reply-To: {$emailaddress} \r\n";
//Send the email!
//mail("*****@*****.**", "this is executing66666", "this is executing666666");
mail($to, $email_subject, $email_body, $headers);
//done. redirect to thank-you page.
/// Send the HTML email to the user
//include('drupal_send_exist.php');
include 'sendemail.php';
SendHTMLEMail(1, $email, $email_from, $email_subject, "Dear", $salutation, $lastname);
header('Location: /existing-volunteers-thank-you/');