Hi, I'm building a web 2.0 thingy from scratch and I wanna display text which users input. It's all good so far, except that all the linebreaks are destroyed, so no matter how carefully they insert whitespace, their input gets displayed as one big block of text.
The data is submitted (method="post") through a textarea. The mysql_real_escape version is stored in mysql. Then it's read from the database (no unescaping necessary) and passed through htmlentities before being printed into the body of the webpage.
I tried replacing htmlentities with the following function:
Line number On/Off | Expand/Contractfunction brentities($x){ $x = str_replace("[LINEBREAK]","nr",$x); $x = str_replace("[LINEBREAK]","rn",$x); $x = str_replace("[LINEBREAK]","n",$x); $x = htmlentities($x); $x = str_replace("<pre>n</pre>","[LINEBREAK]",$x); return $x;}
But this doesn't seem to work. I also tried setting "white-space: pre;" in the CSS for the appropriate div, but that caused the text to bleed outside the div (and even outside the screen), so no go
What's the best way to settle this issue?
Thanks
Preventing blank or already entered values
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLANK entries, into my process php script, using feof, I have failed many times and get so many errors
Email to a friend script problems
I have this send-to-a-friend script with 2 issues:1) When you open the form popup on a particular page, it includes the correct URL for that page (viewable on the popup form). But if you close it, go
How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.However the problem is everytime I get a visitor to the webpage it calls the API which means lots of wasteful
Mail Script Problems
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two values side by side like so $Fname $Lname. Where ever i use tag the values appear in the final
Validation
Hello I know this is a really vag question.I need to have a input field on a form that only submit's if the text inserted starts with any two letters and any four numbers
Got A Free Server :(
So I was given a free server http://shopping.yahoo.com/p:Compaq%20ProLiant%201500%20Server:1990708735It is a Compaq Proliant 1500 :|And I cannot seem to get it to install any OS from the CD drive
PHP & Images [Resize, Crop, Save]
Hey! Well I have a little dilema, hoping I could find some guidance.I have a CMS and on the actual website I am building I have a nice little slideshow script that runs through all the images in a
foreach and array need help combining
Hi guys.Here's the codeCode: array( 'tag' => 'code', 'type' => 'unparsed_content', 'content' => '<div
Trouble verifying database password
Thankyou to everyone who responded to my last post (I can't find the posting, it has been buried). I am currently making a login form and the associated php code. It all seems to work apart from the
Can I use a loop
Hi buddies!