![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
fluidstudios
-
Posts
1 -
Joined
-
Last visited
Never
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
PHP Email Forms - doesn't send the email every time
in PHP Coding Help
Posted
The two websites affected are
www.fluidstudioswms.com and www.hertfordshire-web-design.co.uk
I 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="mail@fluidstudioswms.com">
<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 = "mail@fluidstudioswms.com";
$EmailTo = "mail@fluidstudioswms.com";
$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\">";
}
?>
-----------------------------------------------------------