Jump to content

PHP Form Sending Emails with no information....??


neilcooper33

Recommended Posts

Hi All

 

i am a newbie web developer and have created a few contact forms for websites.  One of the sites is very strange, i am pretty sure i have done everything the same as the other contact forms on other sites, but the form keeps sending emails with no information.  The contact form seems to work when i test it, and can only recreate the problem when i put a space ' ' into the fields i have made mandatory using dreamweaver MM_validateForm functions.  Are people really putting a space in the fields and pressing submit all the time?

 

(link removed)

 

i have attached the php file....

 

If anyone could give me any advice, i would be most grateful

 

thanks in advance

 

Neil

 

[attachment deleted by admin]

It will send null content if the variable is not declared and your php.ini file has errors set to WARNINGS and not ALL. And depending on which version of PHP you are using, you may need to add quotes around the variable name inside the MAIL function. It can act funky sometimes.

Ah, sorry... here's the code...

thanks for the response Gighalen, but would this cause problems all the time? as i said, when i test it, it works... could it be a problem with firefox and ie 6? havent been able to test this yet...?

My hosting page says PHP5... where do i find the php.ini file?

 

Many thanks...

 

N

I will lo

 

<?php
$EmailFrom = "Web Query";
$EmailTo = "[email protected]";
$Name = Trim(stripslashes($_POST['Name'])); 
$Email_Address = Trim(stripslashes($_POST['Email_Address']));
$Telephone_No = Trim(stripslashes($_POST['Telephone_No']));
$Query = Trim(stripslashes($_POST['Query']));
$Subject = "Web Query";
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email address: ";
$Body .= $Email_Address;
$Body .= "\n";
$Body .= "Telephone No: ";
$Body .= $Telephone_No;
$Body .= "\n";
$Body .= "Query: ";
$Body .= $Query;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.html\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.