EchoFool Posted February 19, 2008 Share Posted February 19, 2008 I have a problem with my textarea processing. Say a user creates a list in the text area to post in the forum.. like this: 1) test 2) test 3) test when it is echo'd out in the forums it comes out like: 1) test 2) test 3) test which is not the correct format... how do i maintain the layout structure of the user's input when php is submitting it to the database? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 If it's just new lines, you can use the nl2br() function. If you want to maintain all spacing, try wrapping it in <pre></pre> tags. Quote Link to comment Share on other sites More sharing options...
EchoFool Posted February 19, 2008 Author Share Posted February 19, 2008 So do i do that when i get the value from the form like: $Message = mysql_real_escape_string(nl2br($_POST['Messagge'])); And then also on echo'n do the same thing? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 Do it once, either on storing it into the DB or while echoing it. My personal preference is to do it on echo. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.