When the following details on this form is filled and submitted I am getting the following (name, email, phone, enquiry, reference) submitted info to my database and a copy of this to my email: (Thankyou for submitting your interest in business for sale at Property Group ) but i need the same info that goes to the database (name, email, phone, enquiry, reference) emailed to me, not the Thankyou for submitting bit) How do i set this? <?php require_once('db.inc.php'); if (isset($_POST['submit'])) { $name = $_POST['name']; $email = $_POST['email']; $phone = ereg_replace("[^0-9+ ]", "", $_POST['phone']); $enquiry = ereg_replace("\n", "<br>", $_POST['enquiry']); $reference = $_POST['reference']; echo $biz_id; if (empty($name) || empty($email) || empty($phone) || empty($enquiry)) { echo 'Please fill up all the forms.'; } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { echo 'Email is not validate.'; } else { $query = "INSERT INTO mailing_list (userid, name, email, phone, enquiry, reference, status) VALUES ('', '$name', '$email', '$phone', '$enquiry', '$reference', 'open')"; mysql_query($query) or die("MySQL Error :" . mysql_error()); $eol = "\r\n"; $title = 'BUSINESS GROUP (Enquiry)'; $email = 'info@email.com'; $headers = 'From: Business Groups<info@anotheremail.com>'.$eol; $headers .= 'Content-Type: text/html; charset=ISO-8859-1 '.$eol; $headers .= 'MIME-Version: 1.0 '.$eol; $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $body = 'Dear '.$name.',<br><br>'; $body .= 'Thankyou for submitting your interest in business for sale at Property Group.<br>'; $body .= 'We have captured your details for the business you are interested in and will be contacting you shortly.<br><br>'; $body .= 'Warm Regards,<br><br>'; $body .= 'Business Group<br>'; $body .= 'www.website.com<br>'; $body .= 'www.website2.com'; mail($email, $title, $body, $headers); echo 'Thank you, we will get back to you as soon as possible.<br>'; } } ?> PHP:
As far as I can see, it is already emailing a 'Thank you for submitting' message to . Try putting your email address where it says $email = 'info@email.com'; Code (markup): and it should email it to you. You might want to edit the message it is sending a bit.
Please read carefully my original post as i have edited it. PS. is one i have put in-order not to recieve spam.
You can let the script send another email after the email() command: $title = 'email title'; $email = 'your@email.com'; $headers = 'From: <your@email.com>'.$eol; $headers .= 'Content-Type: text/html; charset=ISO-8859-1 '.$eol; $headers .= 'MIME-Version: 1.0 '.$eol; $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $body = 'Data:<br><br>Name: '.$name.'<br>Email: '.$email.'<br>Phone: '.$phone.'<br>Enquiry: '.$enquiry.'<br>Reference: '.$reference.'<br>'; mail($email, $title, $body, $headers); PHP: I can't test it here, but it should work.
Nearlly Its all now how i want it except I am getting all th re-submitted fields info emailed to me, except for the senders email ? I want the senders/submitters email not my email that i set in there sent to me. PS. Thanks very much
Oops, I forgot about that The fixed version... $title = 'email title'; $youremail = 'your@email.com'; $senderemail = $_POST['email']; $headers = 'From: <your@email.com>'.$eol; $headers .= 'Content-Type: text/html; charset=ISO-8859-1 '.$eol; $headers .= 'MIME-Version: 1.0 '.$eol; $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $body = 'Data:<br><br>Name: '.$name.'<br>Email: '.$senderemail.'<br>Phone: '.$phone.'<br>Enquiry: '.$enquiry.'<br>Reference: '.$reference.'<br>'; mail($youremail, $title, $body, $headers); PHP: