PDA

View Full Version : Concatenation in PHP Mail Script



grandsp5
August 28th, 2003, 07:10 PM
Can someone just take a look at this and tell me if I did everything right in this mail script. The thing I was least sure about was the concatenation operator. I think its a . not a + but I am not sure.



<?

$Name = $_GET['name'];
$Email = $_GET['email'];
$Message = $_GET["Name ".'name'." Address".'address'." Phone".'phone'." Graduation Year".'grad'];
$Subject = "Site Response";
$Header = "From: $Name <$Email>";



$new = mail($Email, $Subject, $Message, $Header);

?>

Digitalosophy
August 28th, 2003, 07:48 PM
$Message = $_GET["$name, $add, $etc"];

grandsp5
August 29th, 2003, 04:07 PM
Can you explain a little more please?
I want it to email
"Name: (their name)
Address: (their address)
Phone: (their phone)
Graduation Year: (their grad year)"

the variables are name, address, phone, and grad

Voetsjoeba
August 29th, 2003, 04:16 PM
<?

$name = $_GET['name'];
$email = $_GET['email'];
$address = $_GET['address'];
$phone = $_GET['phone'];
$grad = $_GET['grad'];
$message = "Name :".$name."\n";
$message .= "Address :".$address."\n"
$message .= "Phone :".$phone."\n";
$message .= "Graduation Year :".$grad."\n"
$subject = "Site Response";
$header = "From: ".$name." <".$email.">";

mail($email, $subject, $message, $header);

?>



I think that should do it. I'm not sure if it is \n or /n. Try them out. Look closely at the colour syntax and you'll figure out the . operator :) But look out: this will email the address you got using GET.

grandsp5
September 2nd, 2003, 12:25 PM
ok. thanks voetsjoeba

Voetsjoeba
September 2nd, 2003, 01:25 PM
No problem :)