kevdotbadger Posted November 2, 2006 Share Posted November 2, 2006 Hello, im writing a simple script which html is entered into a form, the ata is prcessed and it returns the formatted code, with htmlentries removed and replaced with there text equvilent.<html><head><title>Upload</title></head><body><?php$posttext = $_POST['code'];$posttext_remove_crap = htmlspecialchars($posttext);if(isset($posttext)){echo "<div style='padding: 10px; border: 1px solid black; display: block; width: 900px;'>";echo $posttext_remove_crap;echo "</div>";};?><form action="convert.php" method="POST"><textarea name="code" rows="100" cols="100"></textarea><input type="submit" value="Go"></body></html>so far the html removal works. But its all returned in one line and the format is gone (white space, paragraph space etc)how would i go about keeping the format when the string is echoed? Link to comment https://forums.phpfreaks.com/topic/25971-keep-formats-with-strings/ Share on other sites More sharing options...
kenrbnsn Posted November 2, 2006 Share Posted November 2, 2006 You need to use the [url=http://www.php.net/nl2br]nl2br()[/url] function when you display value.Ken Link to comment https://forums.phpfreaks.com/topic/25971-keep-formats-with-strings/#findComment-118689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.