html - PHP Textarea append -


ok let's have textarea , type in textarea

hello name frank , eat apples. 

then when hit submit button get:

[hello name is] [frank , like] [to eat apples.] 

see how every line appended @ start , end brackets?

is there way can in php?

yes:

$output = '['.str_replace("\n", "]\n[", $input).']'; 

i'm not sure if textarea sends \n or \r\n. if latter, change \n \r\n in above.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -