Jump to content


Photo

Feedback form problem


  • Please log in to reply
2 replies to this topic

#1 flannerz

flannerz
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 26 March 2006 - 08:43 PM

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.

<?
$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;

?>

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

Thanks

#2 flannerz

flannerz
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 29 March 2006 - 09:48 AM

Can anyone help me with this?

#3 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 29 March 2006 - 09:59 AM

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:


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

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users