<?php
// Code submited by Glimpsnet systems inc.

	$EmailFrom = Trim(stripslashes($_POST['firstname'])); 
	$sendto = Trim(stripslashes($_POST['sendto']));
	$Subject = "APPLICATION.";
	//
	$firstname = Trim(stripslashes($_POST['firstname'])); 
	$middlename = Trim(stripslashes($_POST['middlename'])); 
	$lastname = Trim(stripslashes($_POST['lastname']));
	$gender = Trim(stripslashes($_POST['gender'])); 
	$dob = Trim(stripslashes($_POST['dob']));
	$email = Trim(stripslashes($_POST['email']));
	$altemail = Trim(stripslashes($_POST['altemail']));
	$fax = Trim(stripslashes($_POST['fax']));
	$cellphone = Trim(stripslashes($_POST['cellphone']));
	$workphone = Trim(stripslashes($_POST['workphone']));
	$homephone = Trim(stripslashes($_POST['homephone']));
	$workcontact = Trim(stripslashes($_POST['workcontact']));
	$streetadd = Trim(stripslashes($_POST['streetadd']));
	$city = Trim(stripslashes($_POST['city']));
	$state = Trim(stripslashes($_POST['Applicantsname']));
	$zipcode = Trim(stripslashes($_POST['zipcode']));
	$resume = Trim(stripslashes($_POST['resume']));
	$checkbox = Trim(stripslashes($_POST['checkbox']));
	
// validation
$validationOK=true;
if (Trim($sendto)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=Application.html\">";
 // route to error handling page
  exit;
}

// prepare email body text
$Body = "";
$Body .= "First Name:  ";
$Body .= $firstname;
$Body .= "\n";

$Body .= "Middle Name:  ";
$Body .= $middlename;
$Body .= "\n";

$Body .= "Last Name: ";
$Body .= $lastname;
$Body .= "\n";

$Body .= "Gender:  ";
$Body .= $gender;
$Body .= "\n";

$Body .= "Date of Birth:  ";
$Body .= $dob;
$Body .= "\n";

$Body .= "Email:  ";
$Body .= $email;
$Body .= "\n";

$Body .= "Alternate Email:  ";
$Body .= $altemail;
$Body .= "\n";

$Body .= "Fax Number:  ";
$Body .= $fax;
$Body .= "\n";

$Body .= "Cell Phone:  ";
$Body .= $cellphone;
$Body .= "\n";

$Body .= "Work Phone:  ";
$Body .= $workphone;
$Body .= "\n";

$Body .= "Home Phone:  ";
$Body .= $homephone;
$Body .= "\n";

$Body .= "Can we contact you at work?:  ";
$Body .= $workcontact;
$Body .= "\n";

$Body .= "Street Address:  ";
$Body .= $streetadd;
$Body .= "\n";

$Body .= "City / Surb / Town :  ";
$Body .= $city;
$Body .= "\n";

$Body .= "State:  ";
$Body .= $state;
$Body .= "\n";

$Body .= "Zip:  ";
$Body .= $zipcode;
$Body .= "\n";

$Body .= "Resume Details:  ";
$Body .= $resume;
$Body .= "\n";

// send email 
$success = mail($sendto, $Subject, $Body, "Application of: <$EmailFrom>");

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

Recommended Answers

All 4 Replies

how u r checking whether the mail is send or not. i think u r working through localhost. To make sure that mail is working or not u should check by hosting it.Then only u can..In localhost i think it won't work.

Member Avatar for diafol

Urgh. Use code tags - can't read all that. Like niths says, if you're not running a mail server (ie. SMTP), you can't send.

BTW:

1. Use header() refresh as opposed to meta refresh if possible.
2. Trim() is not accepted, but trim() is.
3. Why are you using :

$Body .= "Zip: ";
$Body .= $zipcode;
$Body .= "\n";

As opposed to

$Body .= "Zip: $zipcode\n";

You're bloating the code needlessly.

Member Avatar for diafol

smtp no sir only for gmail no smtp mail please coding problem.Hello my website is
the site submit button is not working .details not submiting in him.Data base programme problem please send the programme.

WHAT the hell are you blathering on about man? Are you just advertising your site? If your website is called "webdesigntoolkit", you obviously DO NOT need any advice on such a simple matter. I realise that English may not be your first language (like me), but this post makes very little sense. POst your code, or better still, start your own thread as opposed to hijacking somebody else's.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.