| | |
HTML is trimming my spaces help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
So I have some PHP code that takes text from a mysql table and prints it to the screen with formatting. Problem is the spaces keep getting truncated when its formatted.
Like:
would come out as:
The formatting code just puts the text in <div> tags and the text shows properly in the mysql database so I'm sure it's not that.
Both lines are part of the same entry. I tried messing with the CSS "white-space" attribute and the "pre" value properly shows line breaks but the text goes past the element's boundaries. I guess I could stick <p> tags in between them, but then I'd be manipulating strings and I keep thinking theres a more simple solution.
Anyone know how to circumvent this?
Like:
•
•
•
•
I like cookies.
They are tasty.
•
•
•
•
I like cookies. They are tasty.
Both lines are part of the same entry. I tried messing with the CSS "white-space" attribute and the "pre" value properly shows line breaks but the text goes past the element's boundaries. I guess I could stick <p> tags in between them, but then I'd be manipulating strings and I keep thinking theres a more simple solution.
Anyone know how to circumvent this?
Use nl2br()
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
![]() |
Similar Threads
- PR6 "Computer" directory. 20 spaces. $8 mo. (Ad Space for Sale)
- HTML question (HTML and CSS)
- HTML Page Compressors (Search Engine Optimization)
- is BB Code html? (HTML and CSS)
- HTML question about creating a certificate form? (HTML and CSS)
- Virus/spyware: trojan-spy.html.smitfraud.c (Viruses, Spyware and other Nasties)
- change spaces in fields submitted (PHP)
- Msn Spaces coding (Geeks' Lounge)
- This ought to be simple - extra spaces (PHP)
Other Threads in the PHP Forum
- Previous Thread: Drawback of php
- Next Thread: php syntax error display..
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend






