Could someone help me with this - I've cracked my head since.

When i submit a form and then retrieve the data, there is no paragraphs.

Yes I am aware of HTML encoders like TINYMCE but I'd like to submit in plain text.

I tried htmlentities and htmlspecialchars but nothing works. I just want to see a new paragraph when I've received the data of a submitted form. (a New paragraph after hitting ENTER twice)

Thanx

Recommended Answers

$output = "";
$array = explode("\r\n\r\n", $_POST['freetext']);
foreach($array as $paragraph)
	$output .= "<p>$paragraph</p>\n";
echo $output;
Jump to Post

All 4 Replies

$output = "";
$array = explode("\r\n\r\n", $_POST['freetext']);
foreach($array as $paragraph)
	$output .= "<p>$paragraph</p>\n";
echo $output;
Member Avatar

Even you can also use the <br/> tag to break the paragraph.

Even you can use nl2br function during displaying it.

e.g. <td><?php echo nl2br($address);?></td>

WOW. WORKS WONDERS. A HUGE THANK YOU TO LethargicCoder, AND ALSO TO rajarajan07 AND TO vibhadevit

Have a great day guys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.