New Line String Replacement using textarea

Started on the old forum in August 2009 · view the original in the archive · old links redirect here

6 replies · 789 views · started 17 years ago · 1 min read

4 participants
something else Fellow · 2,296 posts #1

anyone know how to get new lines working with textarea before going through database.

iv tried:

$mes = $_POST["mes"];
$mes = str_replace(array("\r\n", "\r", "\n"), "<br/>", $mes);
echo $mes;

Nothing seems to work unless its been run through database. But Current code doesnt run through db 😐

something else Fellow · 2,296 posts #2

guess soloution is to run it through database and have instant deletion lol

subzero Super moderator Fellow · 3,954 posts #3
$me = $_POST["mes"];
$mes = str_replace(array("\r\n", "\r", "\n"), "<br/>", $mes);
echo $mes;
$me = $_POST["mes"];
$mes = str_replace("\n", "<br/>", $mes);
$mes = str_replace("\r", "<br/>", $mes);
$mes = str_replace("\r\n", "<br/>", $mes);
echo $mes;

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

something else Fellow · 2,296 posts #4

Tried all thoose ways but decided an array would be smaller i guess i could use form method as GET and use: $mes = str_replace(array("%0D%0A", "%0D", "%0A")," ",$mes);

malaysiawap Junior · 14 posts #5

maybe u can use chr(13) 🙂

exampl

SELECT * FROM TABLE_NAME

$break = str_replace(chr(13)," ",$data[text]);

ewanz Developer · 187 posts #6

Can u give with detail?

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
something else Fellow · 2,296 posts #7
<textarea name="mes">words more words more words</textarea>

i ended up running it through Database and then deleting it straight away lol

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close