Log in

View Full Version : Form PHP Email Help



NiallM90
04-29-2006, 11:58 AM
I am trying to get this script to work ... i have everything working but i dont get the email... plz can some1 help

here is the source:-
<?php
$pfw_ip= $_SERVER['REMOTE_ADDR'];
$Handle = addslashes($_POST['Handle']);
$FirstName = addslashes($_POST['FirstName']);
$Occupation = addslashes($_POST['Occupation']);
$ID1 = addslashes($_POST['ID1']);
$ID2 = addslashes($_POST['ID2']);
$ID3 = addslashes($_POST['ID3']);
$Email = addslashes($_POST['Email']);
$Age = addslashes($_POST['Age']);
$Country = addslashes($_POST['Country']);
$CSmaps = addslashes($_POST['CSmaps']);
$PCDescription = addslashes($_POST['PCDescription']);


if (strlen($ID1) !=1)
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid Steam ID</font></p>");
}

if (strlen($ID1) == 0 )
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid Steam ID</font></p>");
}

if (strlen($ID2) !=1)
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid Steam ID</font></p>");
}

if (strlen($ID2) == 0 )
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid Steam ID</font></p>");
}

if (strlen($ID3) !=7)
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid Steam ID</font></p>");
}

if (strlen($ID3) == 0 )
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid Steam ID</font></p>");
}

if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
{
die("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Please enter a valid email address</font></p>");
}


$pfw_header = "From: $Email\r\n"
. "Reply-To: $Email\r\n";
$pfw_subject = "New Clan Member";
$pfw_email_to = "myemail";
$pfw_message = "Visitor's IP: $pfw_ip\r\n"
. "Handle: $Handle\r\n"
. "FirstName: $FirstName\r\n"
. "Occupation: $Occupation\r\n"
. "ID1: $ID1\r\n"
. "ID2: $ID2\r\n"
. "ID3: $ID3\r\n"
. "Email: $Email\r\n"
. "Age: $Age\r\n"
. "Country: $Country\r\n"
. "CSmaps: $CSmaps\r\n"
. "PCDescription: $PCDescription\r\n";
mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;



echo("<p align='center'><font face='Times New Roman' size='3' color='#000000'>Thank you, you should receive a reply with in 24 hours.</font></p>");
?>


This is the code in my form
<FORM action=registration.php method=post name="Clan Registration">
Thanks

Twey
04-29-2006, 12:03 PM
Headers should be seperated using CRLF (\r\n) not just LF (\n).

NiallM90
04-29-2006, 12:11 PM
i tryed that no change

Twey
04-29-2006, 12:40 PM
Use two linebreaks after the last header.

NiallM90
04-29-2006, 12:55 PM
can u quote that coz im nt sure what u mean

Twey
04-29-2006, 01:17 PM
$pfw_header = "From: $Email\r\n"
. "Reply-To: $Email\r\n\r\n";

NiallM90
04-29-2006, 01:22 PM
im still not being send an email

Twey
04-29-2006, 01:45 PM
OK, the next thing to do is to check the return value from the mail() call. If it's TRUE, you've deeper problems at the system level.

NiallM90
04-30-2006, 02:29 AM
... sor this is my first time using .php can u tell me what to do....

Twey
04-30-2006, 11:46 AM
]die(mail($pfw_email_to, $pfw_subject, $pfw_message, $pfw_header));