Jump to content

Formatting inside the <textarea> code.


MinusMyThoughts
 Share

Recommended Posts

If I want to take the input from a form, such as this:

<textarea rows="15" cols="20" name="newsBody"></textarea>

and keep the input formatted in a manner determined by the user (i.e. keeping line breaks), what are my steps?Is there a simple HTML answer, or am I getting into something a little more advanced?Thanks so much!love,JasonAlso, sorry about the "<textarea>" in the title. I thought I needed that. Apparently I'm a worrier.

Link to comment
Share on other sites

I dont really understand you, you can set the font?
Sorry. Let me clarify:Say the user inputs text as:"Hello,This is my text. I hope you like it.Sincerely,User"When I go to retrieve that information and display it somewhere else (I'll be using PHP for this portion of things), it displays as:"Hello, This is my text. I hope you like it. Sincerely, User"How can I get all my line breaks to include themselves when I submit the text in my text area?Hopefully this makes a little more sense...Jason
Link to comment
Share on other sites

If using php try this. If you put the text input into a variable $text then print it on screen using:print nl2br($text);which will print it out with the line breaks. Its a start but you will run into problems if the user starts placing single and double quote marks into the text so you will also need to take that into account.

Link to comment
Share on other sites

you will run into problems if the user starts placing single and double quote marks into the text so you will also need to take that into account.
Thanks!I'll check into safeguarding against the quotes. You've been a great help!Jason
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...