简体   繁体   中英

HTML textarea with <script> tags in it

I'm trying to make a textarea ( name="google_analytics_code" ) that will save in the DB the google analytics script. The problem is that it will not even POST anything ( $_POST['google_analytics_code'] = "" ) if I paste the script from google with script tags in it.

How can I make the textarea to be posted with the whole script (including script tags)?

It should work. See this JSBin for a demo.

If it's not working, it would help to see code — an example of a stripped-down HTML page and PHP script that reproduce the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM