Keeping Formating from textarea's

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
digitalwolf
Forum Newbie
Posts: 1
Joined: Thu May 16, 2002 5:42 pm

Keeping Formating from textarea's

Post by digitalwolf »

I am having trouble keeping the formatting of information entered into a textarea in my form.
I have found some help keeping the lines breaks at the appropriate place but I need help keeping
the spacing. As in if some puts in three or four spaces instead of one and keeping that fromat.
This is driving me crezy. Crazy designers keep coming up with annoyting problems for me
to solve.

Thanks for any help
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

a few suggestions, they might not work but its worth a try

<pre>...</pre> was designed to prevent formatting...but it doesnt escape html...

perhaps

<pre><textarea>stuff </textarea></pre> would work?

also...no clue but do &nbsp;'s work in textareas?
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Have you looked at nl2br()
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

if you're saying that the script takes out the the spaces try

$foo = ereg_replace(" ", "&nbsp;", $foo);
$foo = nl2br($foo); // i dont use this so it might be wrong


you might also want to look into
wordwrap()
Post Reply