HTML, PHP, formating a text area when emailed

Hello,

I am using an html text area box and I would like it so that when it is emailed using my php script it keeps the returns.

Any idea of how to do that without java?
LVL 1
movieprodwAsked:
Who is Participating?
 
NerdsOfTechTechnology ScientistCommented:
use nl2br
http://us2.php.net/manual/en/function.nl2br.php
$entry = mysql_real_escape_string($_POST['entry']);
 
 
if(isset($_POST['email'])){
 
mysql_query("update notes set entry='$entry', list_date='$list_date' where userid='$userid'")or die(mysql_error());
 
 
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
 
             $to = $email2;
 
 
        $message = $message . $entry;
        $message = nl2br($message);
 
 
 
 
        //echo("The value received is " . $to .  "<BR>" . $subject .  "<BR>" . $message .  "<BR>" .$headers );
        mail ($to, $subject, $message, $headers);
        header("target: _self");
 echo 'emailed';
 header("Location: control_panel_notebook.php?msg=Your entry has been sent.");

Open in new window

0
 
Dean OBrienCommented:
Post your code
0
 
movieprodwAuthor Commented:
       $entry = mysql_real_escape_string($_POST['entry']);


if(isset($_POST['email'])){

mysql_query("update notes set entry='$entry', list_date='$list_date' where userid='$userid'")or die(mysql_error());


        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

 
             $to = $email2;
 

        $message = $message . $entry;


 
 
        //echo("The value received is " . $to .  "<BR>" . $subject .  "<BR>" . $message .  "<BR>" .$headers );
        mail ($to, $subject, $message, $headers);
        header("target: _self");
 echo 'emailed';
 header("Location: control_panel_notebook.php?msg=Your entry has been sent.");

0
 
Dean OBrienCommented:
Its not really clear what you mean, keeps and returns... does the above script send an email correctly? please be more specific.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.