Dynamically inserting html from external file and updating the database
This looks very clean, there is not much to improve upon.

However, there is a glaring security issue:
https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

Your code should not allow malicious JavaScript to be stored inside of the db.