I'm working on a small backend admin area. One feature is to allow the webmaster to insert data into a textarea and then submit it to the proper page. So they can update content.
The webmaster I guess does not know html and I was wondering with php I would be able to format the text in the textarea to html. Or I guess if worse comes to worse add a

<br>

tag to every line that extends 58 characters. Does anyone know a real easy way to do this?

    With textarea's, if you have wrapping turned on, the user doesn't usually put in carriage returns, so you might just end up putting in line breaks.

    I don't know of any sort of function in PHP that would format the text for you, but you could easily write one and just pass the text to it.

      $text = ereg_replace("\n","<br>", $text);
      

      will convert any line breaks in the text area to a <BR> Tag

      example:

      line1
      line2
      line3

      will make: line1<br>line2<br>line3

        oh cool that worked thanks!!

          Write a Reply...