Page 1 of 1

Creating line breaks in output?

Posted: Wed Feb 18, 2004 3:39 pm
by Lou Ghaddar
I have made an email form in Flash that outputs to a PHP file to then be mailed to an email address. Everything works but the output in the email is all on one line. I would like to be able to make a line break so that each output would be on its own line.
The FLash form has seven fields that are all user input fields. (i.e. firstName, lastName, phone, altPhone, address, and commentBox.) I would like each one to appear in the email on it's own line.

The code is as follow:

<?php
$sendTo = "lou@selway.umt.edu";
$subject = "Design Turf Career Oppurtunities Reply";
$headers = "From: " . $_POST["firstName"]. "','".$_POST{"lastName"];
$headers .= "<" . $_POST["email"] .">\r\n";
$message = "First Name: " . $_POST["firstName"]. "','".$_POST["lastName"]. "','".$_POST["phone"]. "','".$_POST["altPhone"]. "','".$_POST["email"]. "','".$_POST["address"]. "','".$_POST["commentBox"];

mail($sendTo, $subject, $message, $headers);
?>

Posted: Wed Feb 18, 2004 3:50 pm
by Dr Evil
To make a line break just add

Code: Select all

\r\n
where you want the carriage returns

Doc

Posted: Wed Feb 18, 2004 3:52 pm
by Lou Ghaddar
Great, thank you very much. :wink:

Posted: Wed Feb 18, 2004 3:54 pm
by Dr Evil
You actually already have it in the code after $headers

:wink:

Posted: Wed Feb 18, 2004 9:01 pm
by Lou Ghaddar
I have tried it, and when I put it in the code no longer processes anything. Does it need to be in quotations, or brackets? And where exactly in the code should it be placed? I did this and it doesn't work.

$message = "Name: " . $_POST["firstName"]. " ". $_POST["lastName"].">\r\n" "Phone: ". $_POST["phone"];

Posted: Wed Feb 18, 2004 9:33 pm
by Illusionist
$message = "Name: " . $_POST["firstName"]. " ". $_POST["lastName"].">\r\n" "Phone: ". $_POST["phone"];

change to:

$message = "Name: " . $_POST["firstName"]. " ". $_POST["lastName"].">\r\nPhone: ". $_POST["phone"];

Posted: Wed Feb 18, 2004 9:36 pm
by John Cartwright
Illusionist wrote:$message = "Name: " . $_POST["firstName"]. " ". $_POST["lastName"].">\r\n" "Phone: ". $_POST["phone"];

change to:

$message = "Name: " . $_POST["firstName"]. " ". $_POST["lastName"].">\r\nPhone: ". $_POST["phone"];
change to

Code: Select all

<?php
$message = "Name: " . $_POST['firstName']. " ". $_POST['lastName'].">\r\nPhone: ". $_POST['phone'];
?>

Posted: Wed Feb 18, 2004 9:40 pm
by Illusionist
same thing only the " to ' but that doesn't make a difference

Posted: Wed Feb 18, 2004 9:53 pm
by John Cartwright
security reasons + neater code

Posted: Wed Feb 18, 2004 10:05 pm
by Illusionist
agree with the neator code, but what about the security issues... how so?

Posted: Wed Feb 18, 2004 11:43 pm
by Lou Ghaddar
I will give it a shot. Thanks for the tips everyone. :)

Posted: Thu Feb 19, 2004 12:43 am
by Lou Ghaddar
Perfect! It works perfectly. Thank you all so much. :D