gterre Posted February 21, 2007 Share Posted February 21, 2007 Hello all, I am having problems displaying text. I have disabled html using htmlentities() however i would like to show returns. Is there any way to do this? Link to comment https://forums.phpfreaks.com/topic/39547-solved-help-with-displaying-text/ Share on other sites More sharing options...
Caesar Posted February 21, 2007 Share Posted February 21, 2007 Not sure what it is you're asking. Too vague. Where would you like to display text? Is there user input involved? What does your exsiting code look like? etc....Also, you can make exceptions when cleaning out html, and only allow those tags you want. Link to comment https://forums.phpfreaks.com/topic/39547-solved-help-with-displaying-text/#findComment-190833 Share on other sites More sharing options...
gterre Posted February 21, 2007 Author Share Posted February 21, 2007 this is how i have it set up.. the user inputs text into a textarea field pressing enter on the keyboard for breaks. text goes into the database. using a select query the text is displayed, however the breaks entered by pressing the enter key is not honored and is replaced by a space. I would like it so that the breaks entered into the textarea would be honored and appeared exactly as entered. Link to comment https://forums.phpfreaks.com/topic/39547-solved-help-with-displaying-text/#findComment-190842 Share on other sites More sharing options...
kenrbnsn Posted February 21, 2007 Share Posted February 21, 2007 You have to do the functions in the correct order: <?php echo nl2br(htmlentities($_POST['textarea'])); ?> Ken Link to comment https://forums.phpfreaks.com/topic/39547-solved-help-with-displaying-text/#findComment-190845 Share on other sites More sharing options...
gterre Posted February 21, 2007 Author Share Posted February 21, 2007 Thanks for the help, returns are working fine. I had no idea that function existed. Link to comment https://forums.phpfreaks.com/topic/39547-solved-help-with-displaying-text/#findComment-190856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.