mikal Posted July 9, 2007 Share Posted July 9, 2007 ??? My form works, but I get two emails: In the From part when i test it I get the person email address who sent it. AND I get one from Apache Can anyone tell me how to stop this. Not savvy enough to figure it out with tutorials I seen. My thank you page which submits the results look like this code: <?php /*$ip = $_POST['ip'];*/ $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; } if (eregi('http:', $notes)) { die ("Do NOT try that! ! "); } if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Use Back - fill in all fields</h2>\n"; } $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = "Case Referral from HornLaw-referral.com"; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; mail("[email protected]", $subject, $message, $from); ?> <p align="left"> <span class="price"><span class="price">Date</span>:</span> <?php echo $todayis ?> <br /> <span class="style22"><span class="style23">Thank You</span>:</span> <?php echo $visitor ?> <br /> ( <?php echo $visitormail ?> ) <br /> <span class="price"><span class="style23">Message</span>:</span><br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> Any help out there. An advanced Thank you of any help. m Link to comment https://forums.phpfreaks.com/topic/59095-two-emails-on-php-form-sumbission/ Share on other sites More sharing options...
akitchin Posted July 9, 2007 Share Posted July 9, 2007 it's because you're not using an if() conditional to only send the e-mail if the form was sent. it will send an e-mail every time the page is accessed because that's exactly what it's written to do: if (isset($_POST['submit_button_name'])) { // the header code here } Link to comment https://forums.phpfreaks.com/topic/59095-two-emails-on-php-form-sumbission/#findComment-293443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.