Jump to content

PHP Email Forms - doesn't send the email every time


fluidstudios

Recommended Posts

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 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\">";
}
?>
-----------------------------------------------------------
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.