Let suppose we’ve database table my_code
Input
I’ll create connection to this database table
I’ll create form with post action
I’ll create inside this form a textarea where i would write the input

I want
To add HTML code inside this textarea to be saved in database table my_code
then i can get the HTML code applied in output page.
Output Problem
If i put the following code inside the textarea after i replaced < to < and > to >

Now the output when i can it from database table my_code will appears as code

While i want it appears normally as visual HTML (applied) as following

Note : someone said rather than rendering html code in the input text just put it as it < and > and yes it would appears in output just as i want but when i try to edit it in edit page will find a huge distortion where it become active as textarea inside textarea so i must rendering it but in same time i want it appears as i want.
This problems hurts me so much so any idea,keywords or solutions for it please give help, thanks.
Yes. Then only apply the HTML escaping (
htmlspecialchars) when you want to edit your content.If you want to output it as raw HTML (meaning it becomes a functional
<textarea>+text), then do not apply said HTML escaping.You cannot use the same htmlescaped data for both purposes. You have to apply it depending on what you want to do with it, and best only right before you do so.