|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Forms problem
Hi,
I am having trouble with a form textbox...a simple matter? Not for me. I am trying to create a textbox to stores the data - using php, mysql. No problems here yet. Where I have problems is storing the data so it keeps it's "returns" and "tabs", etc. I haven't even gotten to bold, underlined, etc. I'm not trying to create a wysiwyg editor, just a text box that stores text, then I have another page that will display the text. Currently I am doing this for an online newsletter. I works. The teacher types in the forms and the output is okay, but without any "returns" or <br> in html. How do I do this? BBforums have a cool feature for writing forum posts, as does this. This post doesn't delete the "returns". How complicated is this textbox? I'd love to view this code... just for the way it keeps the "returns". I tried using a function to no edit function but I found it could yield some strange results, like very long lines if the user never added a return, just let the line go on and on, it ignored the restricted output textbox... Anyway, any help would be appreciated.
__________________
bow wow! |
|
#2
|
|||
|
|||
|
Lets assume you have given your textarea a name of "sometext", and you will be posting the form variables.
PHP Code:
The above code should do the trick. If you had output the contents between <pre></pre> blocks, you would have noticed that it worked without nl2br. The difference is that in html a new line character does not show up. only <br> or <br /> shows up as a new line. nl2br will add the <br> to the newline character which allows html to see a newline.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#3
|
|||
|
|||
|
all nl2br does is
replace \r\n or \n to <br> tags ![]() You should also check out php's other text formatting functions at php.net There are functions that will remove html tags, etc |
|
#4
|
||||
|
||||
|
Quote:
According to the php manual, I took it that it doesn't replace the newlines. The excerpt is: Quote:
What that means to me is that on windows \r\n is preserved but <br /> is appended to it. Mac uses \r and Unix uses \n, and the same appeding is applied to those OSes also. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Forms problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|