PDA

View Full Version : PHP Email Form Problem?



fantim
August 13th, 2003, 11:53 AM
Can you guys check out this script and tell me if I got everything right. For some reason it's e-mailing me, but not all the variables that I want. I'm only getting an e-mail with a subject of FANTIMdotORG with no from address or anything like that.



<?

// Recieving and Creating Variables...
$Name = $_POST['name'];
$Email = "fantim@myrealbox.com";
$Message = $_POST['message'];
$Subject = "FANTIMdotORG";
$Addy = $_POST['addy'];
$Header = "From: $Name <$Addy>";



//Performing Mail script...
mail($Email, $Subject, $Message, $Header);

?>

Jubba
August 13th, 2003, 01:40 PM
well you're only telling the script to send the variable $Message. YOu don't define anything else that is supposed to be contained within Message.

Digitalosophy
August 13th, 2003, 01:59 PM
yup you need to include $Addy in your $Message

Jubba
August 13th, 2003, 02:03 PM
and $name... :sigh:

villek
August 13th, 2003, 07:10 PM
<?php

$to = "youremail@domain.com";

$msg = "Name: $name\n\n";
$msg .= "E-mail: $email\n\n";
$msg .= "Phone: $phonenumber\n\n";
$msg .= "Message: $message\n\n";

mail($to, $subject, $msg, "From: YourHomeSite\nReply-To: $email\n");

?>



That's it.

In your Flash you have to have fields, with variable names:

name

subject

email

phonenumber

message

the "send" button has to have the following code:




on (release) {
loadVariablesNum("mymailform.php", 0, "POST");
}



That should do the trick. It's as simple as it gets, 'cause I got the impression you're not very experienced in doing something with php. Neither am I :)

Remember that this code does absolutely no checking whether the mail as sent or not. I recommend that you write a check bit in there also.

Shouldn't be too hard, but I left something for you to solve too :)

Hope that helps.