Re: \n problems when creating an email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 11, 2008 7:10 AM, Angelo Zanetti <angelo@xxxxxxxxxxxxxxx> wrote:
> Hi guys,
>
> I am making email text based on some fields the user fills in and then email
> the admin the details.
>
> I am having a problem where sometimes the \n (new line) works and sometimes
> it just does nothing. Im not sure the cause but I cant seem to figure it
> out.

    Try using HEREDOC syntax instead:

$message =<<<EOM

How far would they be prepared to travel to
event venue?
                                        $travel
Do you have a specific location
of preference?
                                        $locationPref
City or country preference:        $cityPref

EOM;

    It may not prevent the client from reformatting the message on
delivery, as Stut, Nathan, and Wolf already correctly mentioned, but
placing it in a HEREDOC will improve readability, send an exact
structure without need for interpretation (of
newlines-vs-carriage-return-newlines and number of spaces per tab),
and allow you to freely use quotes without having to remember to
escape them (or escape to insert a variable).

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux