- This topic is empty.
-
AuthorPosts
-
January 3, 2011 at 12:20 pm #31142zio4Member
Still fairly new to PHP so please bare with me… My issue is as the subject reads and here is the PHP I used from Chris but altered. Any help is appreciated greatly!!!
$EmailTo = “[email protected]”;
$Subject = “Team Registration! Action Requested”;$TeamName = Trim(stripslashes($_POST));
$ManagerName = Trim(stripslashes($_POST));
$ManagerAddress = Trim(stripslashes($_POST));
$EmailOne = Trim(stripslashes($_POST));
$EmailTwo = Trim(stripslashes($_POST));
$PhoneOne = Trim(stripslashes($_POST));
$PhoneTwo = Trim(stripslashes($_POST));// validation
$validationOK=true;
if (!$validationOK) {
print ““;
exit;
}// prepare email body text
$Body = “”;
$Body .= “TeamName: “;
$Body .= $TeamName;
$Body .= “n”;
$Body .= “ManagerName: “;
$Body .= $ManagerName;
$Body .= “n”;
$Body .= “ManagerAddress: “;
$Body .= $ManagerAddress;
$Body .= “n”;
$Body .= “EmailOne: “;
$Body .= $EmailOne;
$Body .= “n”;
$Body .= “EmailTwo: “;
$Body .= $EmailTwo;
$Body .= “n”;
$Body .= “PhoneOne: “;
$Body .= $PhoneOne;
$Body .= “n”;
$Body .= “PhoneTwo: “;
$Body .= $PhoneTwo;
$Body .= “n”;// send email
$success = mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>“);// redirect to success page
if ($success){
print ““;
}
else{
print ““;
}
?>January 3, 2011 at 12:51 pm #67752zio4MemberI don’t receive anything in the email besides the label text in the form.
January 3, 2011 at 1:38 pm #67754BobMemberAre you missing a quotation mark there maybe?
Shouldn’t:$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
be:
$success = mail("$EmailTo, $Subject, $Body, "From: <$EmailFrom>");
So an added quotation mark before $EmailTo.
January 3, 2011 at 2:55 pm #67760zio4MemberI don’t believe so… the quotation marks in the line contain —-> From: <$EmailFrom>“); <----
January 3, 2011 at 4:52 pm #67689BobMemberIt seems you’re right zio4, I read that wrong. The quotation marks are fine indeed.
However, are you actually even sending the form? I don’t think you are.
To me, it looks like you’re only creating a variable called $success, and give it the value of mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>“)Shouldn’t you after that actually ‘use’ the variable and thus mail the form? Or can’t you just mail(…) instead of making it a variable?
Last, on your line with
if ($success){
, shouldn’t you be comparing that to something, likeif ($success==true){
?EDIT: Ok nevermind, I just saw this is how Chris has coded it so it should be fine.
January 3, 2011 at 6:19 pm #67622zio4MemberThanks for the effort Bob!
Here’s the code again for anyone else… I noticed a few things weren’t showing in the original post.
$EmailFrom = "Nolte Classic";
$EmailTo = "[email protected]";
$Subject = "Registration";
$TeamName = Trim(stripslashes($_POST));
$ManagerName = Trim(stripslashes($_POST));
$ManagerAddress = Trim(stripslashes($_POST));
$EmailOne = Trim(stripslashes($_POST));
$EmailTwo = Trim(stripslashes($_POST));
$PhoneOne = Trim(stripslashes($_POST));
$PhoneTwo = Trim(stripslashes($_POST));
// validation
$validationOK=true;
if (!$validationOK) {
print "";
exit;
}
// prepare email body text
$Body = "";
$Body .= "TeamName: ";
$Body .= $TeamName;
$Body .= "n";
$Body .= "ManagerName: ";
$Body .= $ManagerName;
$Body .= "n";
$Body .= "ManagerAddress: ";
$Body .= $ManagerAddress;
$Body .= "n";
$Body .= "EmailOne: ";
$Body .= $EmailOne;
$Body .= "n";
$Body .= "EmailTwo: ";
$Body .= $EmailTwo;
$Body .= "n";
$Body .= "PhoneOne: ";
$Body .= $PhoneOne;
$Body .= "n";
$Body .= "PhoneTwo: ";
$Body .= $PhoneTwo;
$Body .= "n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "";
}
else{
print "";
}
?>
January 3, 2011 at 7:29 pm #67658TT_MarkMemberTrying dumping out your $_POST variable with
var_dump($_POST);
If it’s empty, then it’s your form..if its not empty, its the PHP.
My guesses are
a) You’ve given the form the wrong method i.e. GET
b) You’ve not named the fields correctly
c) Can you actually use trim() with a capital T?? -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.