Fostav Posted November 15, 2016 Share Posted November 15, 2016 I am using a ready script, which includes account registration and a few functions. Users can edit a text area on their profile which is saved on a database, is a description for something. Editing the template of my script/web i would like to make it, when a user writes for example: OneTwoThree to be displayed like this also cause right now its like One Two Three I'made a re-search on the file's and found out the followings: $description_prepare = str_replace(array("\r\n", "\n", "\r"), ' ', $FORM['description']); $TMPL['description'] = $DB->escape($description_prepare, 1); $TMPL['description'] = $this->bad_words($TMPL['description']); $TMPL['description'] = preg_replace('/[^A-Za-z0-9 .,\-]/', '', $TMPL['description']); as you can see the script is replacing the line breaks with a space ' '. i removed this part completely and made it like $TMPL['description'] = $DB->escape($FORM['description'], 1); $TMPL['description'] = $this->bad_words($TMPL['description']); $TMPL['description'] = preg_replace('/[^A-Za-z0-9 .,\-]/', '', $TMPL['description']); but now when i am editing the description for example from One Two Three to OneTwo Three i am getting back Onern Two Three How can i solve this? Any idea? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Barand Posted November 15, 2016 Share Posted November 15, 2016 Leave the line breaks in the text when saving to the database. If outputting to a text area then leave the breaks as they are. If outputting to to other parts of a page, use nl2br($text) to add <br> to the line breaks. Quote Link to comment Share on other sites More sharing options...
Fostav Posted November 15, 2016 Author Share Posted November 15, 2016 fixed thanks 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.