View Full Version : <br> in html input textboxes?
andr.in
October 6th, 2003, 10:45 AM
:alien: OK... this is kinda wierd question but what's the symbol combination in <input> textboxes in a html form for line breaks... ya know.. in html they're <br>, in text files it's \n etc...
For example if I have an e-mail form and when the users prsses enter to make a line break I want it to dispay a line break in the e-mail message too... e.g. with using ereg_repalce() in php but I don't know what to replace with <br>.. I hope you get what I mean...
:b: :smirk:
Marz
October 6th, 2003, 11:56 AM
$trimmed = eregi_replace("[\n\t\013\r]+", "<br>", $posted);
Now, the only thing this doesn't work for.. Is a line feed after a line feed.. Aka.. 2 returns... I don't know why yet... But this will replace any text input returns to <br>
andr.in
October 6th, 2003, 12:22 PM
oh cool... thx marzman!
It works!
i think the problem with more than one line breaks is that it searches out one or more line break (+ at the end) and then repalces it with only one <br> so 2 becomes one... I think =)
Well.. I don't need multiple <br> anyway.. who needs them.. I'm fine with this! Thx again! :)
Marz
October 6th, 2003, 03:58 PM
No problem man.. :) If you can't read one line feed.. Just read all the bastards! *lmao*..
I'm going to try that + idea.. I think you are correct about that.. Excellent thinking my friend, excellent.
mistoflight
December 5th, 2005, 08:15 PM
$trimmed = eregi_replace("[\n\t\013\r]+", "<br>", $posted);
Now, the only thing this doesn't work for.. Is a line feed after a line feed.. Aka.. 2 returns... I don't know why yet... But this will replace any text input returns to <br>
Can you explain what all of the items in the replace file are? ([\n\t\013\r]+). I am getting a <br> at the beginning of paragraph.
hl
December 5th, 2005, 09:09 PM
i think all you need is \n and \r, they are both line breaks.
\t is tab, don't know what \013 is.
Jeff Wheeler
December 5th, 2005, 09:16 PM
Yeah, \n, \r, and \n\r (I think that's what the last one was… I may be wrong) are all you need.
Also, why do you use <br> rather than <br />?
If you want to get really fancy, the developer of WP wrote this:
http://photomatt.net/scripts/autop
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.