Jump to content

form textbox as is instead on all on one line


flemingmike

Recommended Posts

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);

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.