fluidstudios Posted November 8, 2006 Share Posted November 8, 2006 Bit of a strange problem - I have created two identical websites on different hosts and they both have 3 email forms which do work but not always. I have tested them 5 times today and only recieved emails from them on 3 occasions.The two websites affected arewww.fluidstudioswms.com and www.hertfordshire-web-design.co.ukI am not very good at PHP but can't see anything wrong so it may not be a code problem at all but not sure what else to try. The code for one of the three forms is as follows:HTML:---------------------------------------------------------<form method="POST" action="callback.php"> <input type=hidden name="recipient" value="[email protected]"><input type=hidden name="subject" value="Call back"> <p><font size="2">Your name:</font><br> <input type="text" name="q1"> <p><font size="2">Telephone number:</font><br> <input type="text" name="q2"> <p><font size="2">Preferred time/day for us to call:</font> <em><font size="2">(9.00 to 5.30 - monday to friday)</font></em><br> <input type="text" name="q3"> <p><font size="2">Interested in:<em> (main interest if more than one)</em></font><br> <select name="q4"> <option value=webdesign selected>Web Design</option> <option value=printing>Printing</option> <option value=seo>Search Engine Optimisation</option> <option value=other>Other</option> </select> <p><input type="submit" name="submit" value="Submit"></form>-----------------------------------------------PHP-----------------------------------------------<?php// get data $EmailFrom = "[email protected]";$EmailTo = "[email protected]";$Subject = "Call back";$q1 = Trim(stripslashes($_POST['q1'])); $q2 = Trim(stripslashes($_POST['q2'])); $q3 = Trim(stripslashes($_POST['q3']));$q4 = Trim(stripslashes($_POST['q4']));// validate$validationOK=true;if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">"; exit;}// prepare body text$Body = "";$Body .= "call back! ";$Body .= "\n";$Body .= " ";$Body .= "\n";$Body .= "Q1. = ";$Body .= $q1;$Body .= "\n";$Body .= " ";$Body .= "\n";$Body .= "Q2. = ";$Body .= $q2;$Body .= "\n";$Body .= " ";$Body .= "\n";$Body .= "Q3. = ";$Body .= $q3;$Body .= "\n";$Body .= " ";$Body .= "\n";$Body .= "Q4. = ";$Body .= $q4;$Body .= "\n";;// email $success = mail($EmailTo, $Subject, $Body, "From: $EmailFrom");// redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">";}else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=problem.html\">";}?>----------------------------------------------------------- Link to comment https://forums.phpfreaks.com/topic/26578-php-email-forms-doesnt-send-the-email-every-time/ Share on other sites More sharing options...
Shad Posted November 8, 2006 Share Posted November 8, 2006 try using headers! Link to comment https://forums.phpfreaks.com/topic/26578-php-email-forms-doesnt-send-the-email-every-time/#findComment-121599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.