Author Topic: code for auto response  (Read 373 times)

0 Members and 1 Guest are viewing this topic.

Offline raddisTopic starter

  • Irregular
  • Posts: 1
    • View Profile
code for auto response
« on: September 14, 2007, 07:53:25 PM »
i have a php file on a web site that send information to an email account for inquiry purposes.  i need to add an auto response to the form.  i am new to php--please help
</head>

<body>


        <?
// The error message if there are one or more fields not filled in
$error = "There are some fields not filled in <a href='javascript:history.go(-1)'>click here to go back</a>";

$fullname = $_POST["fullname"];
$address = $_POST["address"];
$email = $_POST["email"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$phone = $_POST["phone"];
$year = $_POST["year"];
$ip = $_POST["ip"];


// Let's check if all fields are filled in!
if($fullname == "" || $address == "" || $email == "" || $city == "" || $state == "" || $zip == "" || $phone == "" || $year == ""){
// Lets echo that error! ;)
echo $error;
}

// Let's do a small IP check..
elseif($ip == ""){
echo "Sorry, an unknow error has occured";
}

else{
$yourwebsite = "??"; // Your website
$recipientname = "Admissions"; // Whats your name ?!
$subject="Request of Information";  // The subject of the mail thats being sended
$recipient="  "; // the recipient

/*
  The headers for the e-mail, no need to change it unless you know what you're doing
*/

// To send HTML mail, the Content-type header must be set
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$header .= 'To: Admissions < ???>' . "\r\n";
$header .= 'From: Information Request <'.$email.'>' . "\r\n";
$browser = $_SERVER['HTTP_USER_AGENT'];
$ip2= $_SERVER['REMOTE_ADDR'];

/*
  You can change the text below to whatever you wish to have
  for the way the mail is gonne be outputted, you can use HTML!
*/
$content="
<html>
<Head>
<Title> Request of Information </Title>
</Head>
<Body>
Fullname: $fullname <br>
Address: $address  <br>
City: $city <br>
State: $state  <br>
Zip: $zip  <br>
Phone: $phone <br>
E-mail: <a href='mailto:$email'> $email </a> <br>
year Graduated: $year  <br>
<br>
<br>
****************<br>
IP: $ip2 <br>
Browswer: $browser <br>
</body>
</Html>
";

// Lets send the e-mail by using the mail() function, no need to change below...this can be edited above!
mail($recipient, $subject, $content, $header);

// Message the user will see if the e-mail is succesfully sended :)
echo "
<p class='plaintext'>Thank you for your interest in </p>
";
}
       
?>

Offline BlueSkyIS

  • Fanatic
  • Posts: 4,261
    • View Profile
Re: code for auto response
« Reply #1 on: September 14, 2007, 07:59:01 PM »
What's not working? Do you see any errors?
deprecated (adj.) Used typically in reference to a computer language to mean a command or statement in the language that is going to be made invalid or obsolete in future versions.

Head Shops and Grow Stores