Guestbook, spamming without spaces scrolls to the right

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
scr0p
Forum Newbie
Posts: 23
Joined: Mon May 05, 2003 6:49 pm
Location: NY

Guestbook, spamming without spaces scrolls to the right

Post by scr0p »

On my guestbook, if the user types lets say "omgomgomgomogmomg" a lot of times, It will keep scrolling to the right, how would I make it go to another line at the edge of the table (html table)?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Have you tried setting a fixed width rather than a percentage width?

Or, you could even process POST'd text and delete any words longer than a set limit.
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

http://www.php.net/wordwrap should solve your problem
scr0p
Forum Newbie
Posts: 23
Joined: Mon May 05, 2003 6:49 pm
Location: NY

Post by scr0p »

Thanks, about to check it out, before I do, how do I make it so that all the newline charecters are "preserved" I have a news edit script, when I type a neatly formatted post (with indentation and paragraphs), I want it to show like that on the news page, but how?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Take a look at nl2br().

If you want to preserve indentation, you'll need <pre> tags.
Post Reply