Jump to content

How Do I Force A Linebreak?

Recommended Posts

I've made a comment box for my site and someone spammed a reaaaallllyyyy long line, and the comment box "broke".I'm using the sliding doors tech, with a 1600w long pic, but what's annoying is that no matter if I set a fixed width or not on FF the comment will just go out of the box (but the box will remain at max-width set) while on IE it'll break no matter what width/max-width I set.Is there a PHP command to force a linebreak from a SQL data?Quick Edit: I'm not asking about \n, but something that would help me prevent comments like that from "breaking" the box and messing the site's layoutQuick Edit2: Found, after some hours (and just after I gave up and resorted to the forums :)) the wordwrap($string, $maxchars) command.

Edited by Shakazahn
Link to post
Share on other sites

You can use the wordwrap() function on the information extracted from the database. It will add a line break to a string at a defined amount of characters.There are other ways to do it, like regular expressions or algorithms using strlen() or many other things.

Edited by Ingolme
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...