Skip to content
Advertisement

How to echo in PHP [closed]

I am trying to display output from following code. The script ish creating cookie policy pop-up.

JavaScript

I am definitely making some syntax mistake in echo '<script></script>'; part, because if statement itself is working (I am able to echo simple <h1><h1> text. And the script itself is also working.

I have tried with echo '<script language="javascript" type="text/javascript">'; and also

JavaScript

I dont’t get any errors. Simply nothing shows up.

Advertisement

Answer

Break out of PHP, or dont put clientside scripting inside serverside echos, instead abstract that code to clientside.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement