PDA

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.