flemingmike Posted December 1, 2010 Share Posted December 1, 2010 hello, is there a way to have it so that when somebody enters information into a textbox in a form, it will keep the formatting (if they have 5 lines, it will show as 5, not 1) $name = $_POST['name']; $resume = $_POST['resume']; $to = "[email protected]"; $subject = "Resume From Website"; $message = "Name: $name <br /> Resume: $resume "; $from = "[email protected]"; $headers = "From: $from \r\n Content-Type: text/html; charset=ISO_8859-1\r\n Content-Transfer_Encoding: 7bit\r\n\r\n"; mail($to,$subject,$message,$headers); Link to comment https://forums.phpfreaks.com/topic/220390-form-textbox-as-is-instead-on-all-on-one-line/ Share on other sites More sharing options...
kenrbnsn Posted December 1, 2010 Share Posted December 1, 2010 Since you are sending a HTML email message, you need to use the function nl2br to display everything correctly. <?php $name = $_POST['name']; $resume = nl2br($_POST['resume']); $to = "[email protected]"; $subject = "Resume From Website"; $message = "Name: $name <br /> Resume: $resume "; $from = "[email protected]"; $headers = "From: $from \r\n Content-Type: text/html; charset=ISO_8859-1\r\n Content-Transfer_Encoding: 7bit\r\n\r\n"; mail($to,$subject,$message,$headers); ?> Ken Link to comment https://forums.phpfreaks.com/topic/220390-form-textbox-as-is-instead-on-all-on-one-line/#findComment-1141960 Share on other sites More sharing options...
flemingmike Posted December 1, 2010 Author Share Posted December 1, 2010 perfect. thanks Link to comment https://forums.phpfreaks.com/topic/220390-form-textbox-as-is-instead-on-all-on-one-line/#findComment-1141964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.