raddis Posted September 14, 2007 Share Posted September 14, 2007 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> "; } ?> Link to comment https://forums.phpfreaks.com/topic/69410-code-for-auto-response/ Share on other sites More sharing options...
BlueSkyIS Posted September 14, 2007 Share Posted September 14, 2007 What's not working? Do you see any errors? Link to comment https://forums.phpfreaks.com/topic/69410-code-for-auto-response/#findComment-348739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.