Good all the time of day.

There is a php page from which I add data to the mysql database, using the normal textarea textbox. Naturally, this option is extremely primitive, for many reasons, it will be a transfer to the next line, or making a part of the text bold ... In my case:

<textarea name="mess" rows="50" cols="80" maxlength="5000"></textarea> 
  1. How are such input forms called? (Need for googling.)
  2. Advise a couple of solutions.
  • What exactly do you want, explain it clearer. - Michael Nikolaev

2 answers 2

This option is not primitive but the most common, you can pass the text through the text and you can send the text as an AYAX, and if you need to edit the text with HTML tags, then you need to install the wysiwyg editor. The essence of their work is simple: when you select text, javascript frames the desired section with tags, for example for bold text and already in this form inserts it into the base for submission to the database

  • Yes, something like a text editor, so that I could enter the text, as we say in a simple text editor. - sergey
  • one
    there is a list of the most popular js editors for websites on Wikipedia, read and choose, but the most popular ones are TinyMCE and CKeditor - makregistr

I do not consider myself an expert in this field, but here are some tips:

  • To save line breaks when outputting to the page, use the PHP function nl2br (returns the string, in which ' <br /> ' is inserted before each line break )
  • For bold text, use the <strong> HTML tags </ strong>. By analogy, you can also implement italics, a list, etc. Well, either use your own notation and replace them with HTML tags before insertion into the database or at the output.
  • Implement only the set of functions that you need. Notice the htmlentities feature