# handling rich text in php-mysql



## bukaida (Apr 12, 2008)

I want to know the process of accepting the superscript and subscript data from html textbox through php and store them in mysql database.Also support for other rich text format is required. 
please help.I am using PHP 4.4.0 with mysql 5 and apache 2.


----------



## victor_rambo (Apr 12, 2008)

You can just store them as HTML. But, while passing them to the sql statement, remember to use the addslashes() function. Similarly, while retrieving the records, just use stripslashes() function.

btw I hope you know how to process form inputs with PHP. If not, plz google it.


----------



## bukaida (Apr 14, 2008)

rohan_shenoy said:


> You can just store them as HTML.



How are you going to write a superscript or subscript in textbox?When I am copying and pasting the superscript/subscript data from MS.Word, it is coming side by side in the text box.I know how to accept data from textbox, but the data itself is not in desired format.I hope you understood the problem.


----------



## victor_rambo (Apr 14, 2008)

^in that case, a textbox wouldn't do what you want. You should use a textarea which is converted into a WYSIWYG editor by javascript.

1. Download TinyMCE. It will convert a textarea element into WYSIWYG HTML editor.
2. Copy-paste the rich text in the WYSIWYG editor.
3. Use it as a form element.


----------

