Glaanieboy
OSNN Veteran Addict
- Joined
- 6 Mar 2002
- Messages
- 2,628
I have been playing around with <TEXTAREA>'s and I have one problem:
I have made a PHP-script (for submitting news) that stores the value in <TEXTAREA> in a MySQL database. hen I have 'enter's (new lines) in the textfield, it is send as a "Here comes%0D%0Athe new line" where %0D%0A is representing the enter. MySQL stores it ok, when I do a SELECT * ... I see the text exactly as I entered it. But, when I call the record with another script and display it on screen, I see it as one long string, with no breaks at all. Logical, because the browser only breaks the line when there is not enough screen width or when there is a <BR>. What I want is at the place where a break is present, replace that break by <BR>, so that it correctly shows up in the browser.
I tried it with a 'strtr' where I use an array of ("%0D%0A" => "<BR>"). It should replace any occurance of %0D%0A with <BR>, but it doesn't.
I know it's possible, I see that forum software does that all the time, but how do they do that?
I hope anyone can understand what I mean, it is very difficult for me to explain in english, because it isn't my native language.
For an example of what I mean, go here (will be up for at least a couple of hours):
http://212.64.24.229/shout/index2.php . There is a Submit News link present, so you can try it if you want.
Thank you for your time!
I have made a PHP-script (for submitting news) that stores the value in <TEXTAREA> in a MySQL database. hen I have 'enter's (new lines) in the textfield, it is send as a "Here comes%0D%0Athe new line" where %0D%0A is representing the enter. MySQL stores it ok, when I do a SELECT * ... I see the text exactly as I entered it. But, when I call the record with another script and display it on screen, I see it as one long string, with no breaks at all. Logical, because the browser only breaks the line when there is not enough screen width or when there is a <BR>. What I want is at the place where a break is present, replace that break by <BR>, so that it correctly shows up in the browser.
I tried it with a 'strtr' where I use an array of ("%0D%0A" => "<BR>"). It should replace any occurance of %0D%0A with <BR>, but it doesn't.
I know it's possible, I see that forum software does that all the time, but how do they do that?
I hope anyone can understand what I mean, it is very difficult for me to explain in english, because it isn't my native language.
For an example of what I mean, go here (will be up for at least a couple of hours):
http://212.64.24.229/shout/index2.php . There is a Submit News link present, so you can try it if you want.
Thank you for your time!