<?PHP
$Surname = $_POST['Surname'];
$OtherNames = $_POST['OtherNames'];
$Dateofbirth = $_POST['Dateofbirth'];
$age = $_POST['age'];
$sex = $_POST['sex'];
$Nationality = $_POST['Nationality'];
$stateoforigin = $_POST['stateoforigin'];
$Entryclassonrequest = $_POST['Entryclassonrequest'];
$religion = $_POST['religion'];
$parentsguardiansname = $_POST['parents/guardiansname'];
$occupation = $_POST['occupation'];
$phonenumbers = $_POST['phonenumbers'];
$whomchildliveswith = $_POST['whomchildliveswith'];
$previousschool = $_POST['previousschool'];
$imunizationdetails = $_POST['imunizationdetails'];
$target_address = 'info@uniqueeducationltd.com';
$headers = "Online Application Form Details";
if mail'('$Surname, $Othernames, $dateofbirth, $age, $sex')' {
echo(("<p><font color=#333366"<b>Thank you for your application, we will get back to you as soon as we can.</b></p>"));
}
else{
echo("<p><font color=#008000"><span class="style1"><strong><font size="5">Sorry Your form submission had some errors. Try again later.</b></p>");
die();
}
?>
<?PHP
extract( $_POST, EXTR_PREFIX_ALL, 'post_' );
$target_address = 'info@uniqueeducationltd.com';
$sSubject = "Online Application Form Details";
$sMessage = 'Surname: ' . $post_Surname . "\n";
$sMessage . = 'Other Names: ' . $post_OtherNames . "\n";
$sMessage . = 'Date of Birth: ' . $post_Dateofbirth . "\n";
$sMessage . = 'Age: ' . $post_age . "\n";
$sMessage . = 'Sex: ' . $post_sex . "\n";
if ( mail( $target_address, $sSubject, $sMessage ) )
{
echo '<p><font color=#333366"<b>Thank you for your application, we will get back to you as soon as we can.</b></p>';
}
else
{
echo '<p><font color=#008000"><span class="style1"><strong><font size="5">Sorry Your form submission had some errors. Try again later.</b></p>';
die();
}
I used
extract to simplify the creation of local variables based on the keys of your POST array. However, unless you're actually sanitizing or validating the data before it gets emails, which you should, there is no reason to create local variables. If you are emailing the raw data anyways, then just use the $_POST['key'] values directly. But, you should really be cleaning the input.
I also corrected your usage of
mail()
**This is untested
Last edited by mschroeder; Jan 20th, 2009 at 12:19 pm.
Reputation Points: 265
Solved Threads: 126
Practically a Master Poster
Offline 624 posts
since Jul 2008