Click to See Complete Forum and Search --> : retaining format in textarea variable posting


T-Wag
03-03-2005, 11:51 AM
I'm trying to make a form that will take it's values, pass them off to a php page, and then get written to a file somewhere on my server. Step 1 pertains to this thread.

I want a text area that the user can type a message into, but that will retain it's formatting and convert it to HTML when it's sent as a variable

Mean, ifthe user types into the text area :

--------------------text area----------------------
Hi,

How are you today?

that's good

--------------------text area----------------------

the variable will send this:

Hi,<br><br>How are you today?<br><br>that's good<br>


see what I mean?

can this be done?

NogDog
03-03-2005, 12:00 PM
If you're going to use PHP on the server side, the simplest solution would be to use the nl2br() function (http://www.php.net/nl2br) there, rather than trying to do it on the browser side.

T-Wag
03-03-2005, 02:01 PM
wwwwow....that function worked so much more easily than I expected.

Next question :D

So I have this textarea, but what if I want to give users the ability to bold some text by selecting it and then hitting a button, like in word or appleworks?

NogDog
03-03-2005, 03:11 PM
Originally posted by T-Wag
wwwwow....that function worked so much more easily than I expected.

Next question :D

So I have this textarea, but what if I want to give users the ability to bold some text by selecting it and then hitting a button, like in word or appleworks?
That would need to be done on the client (browser) side with JavaScript or such, and would be quite a bit more complicated, I would think.