I have a cms that I am working on for a client, he wants to add a code textbox so he can paste special code for pages on a page by page basis. So, I need to be able to give the user a way to input javascript tags into a page they are editing. When that page loads, the java code will show and run.
For example, Facebook code - it would be pasted into this code textarea and saved in the mysql database.
Note - the site is still using mysql_query and has not been converted, client has been told but they have no interest in updating so need the example done in mysql_query.
<script type="text/javascript">(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
How can I safely save this to the database without breaking the javascript?
thanks!