Jump to content

Feedback form problem


flannerz

Recommended Posts

Hi Guys

I seem to have a problem with this simple form handling script. The problem is that is seems to send correctly sometimes and then other times it doesn't send at all. Every test I have done has worked perfectly yet my client has said that sometimes people are using the form yet their details never actually arrive.

Below is the code (private details blocked out). The address that it is been sent to is an '@tiscali.co.uk'. I'm wondering if this could be the problem.

[code]<?
$mailto = '******@tiscali.co.uk';

$subject = "Enquiry";

$formurl = "http://www.******.com/contactus.html";
$errorurl = "http://www.******.com/error.html";
$thankyouurl = "http://www.******.com/thankyoucontactus.html";

$name = $_POST['name'];
$address1 = $_POST['add'];
$address2 = $_POST['add1'];
$town = $_POST['town'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$from = $_POST['from'];
$to = $_POST['to'];
$from1 = $_POST['from1'];
$to1 = $_POST['to1'];

$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit;
}
if (empty($name) || empty($telephone) || empty($email)) {
   header( "Location: $errorurl" );
   exit;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
}

$messageproper =

    "This message was sent from:\n" .
    "$http_referrer\n" .
    "------------------------- Enquiry -------------------------\n\n" .
    
    "Contact name - " .
    $name .
    "\r\n" .
    "Address Line 1 - " .
    $add .
    "\r\n" .
    "Address Line 2 - " .
    $add1 .
    "\r\n" .
    "Town/City - " .
    $town .
    "\r\n" .
    "County - " .
    $county .
    "\r\n" .
    "Postcode - " .
    $postcode .
    "\r\n" .
    "Telephone - " .
    $telephone .
    "\r\n" .
    "Email Address - " .
    $email .
    "\r\n" .
    "I would prefer to stay from the " .
    $from .
    " to the " .
    $to .
    " or alternatively from the " .
    $from1 .
    " to the " .
    $to1 .
    "\r\n" .
    "Other Information - " .
    $comments .
    
    "\n\n------------------------------------------------------------------\n";

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );
header( "Location: $thankyouurl" );
exit;

?>[/code]

I'm no expert in PHP so any pointers would be great

Thanks
Link to comment
Share on other sites

Such faults are hard to determine, i always send mail with the appropriate final message to the user based on the mail status in the end:

[code]

$sendmail = mail($to,$subject,$header,"-f",$return);

if($sendmail)
{
header( "Location: $thankyouurl" );
}
else
{
header( "Location: $errorurl" );
}

[/code]
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.