Hi all,
I am going crazy here trying to call a javascript function from PHP. A very basic version of what I want to do is:
$new = htmlspecialchars("<script type=\"text/javascript\">alert('Clicked on link!');</script>", ENT_QUOTES);
echo $new;
All this does is display <script type="text/javascript">alert('Clicked on link!');</script> (in plain html text) at the top of my webpage rather than call the javascript function. I have also tried this without the htmlspecialchars but I still cant call it so It must be something I am doing wrong with the escaping. I have read through the manual looking at all the functions and trying a "\" before some of the characters etc but feel really really lost. Can someone please advise me on this and what I can try next. I keep running into trouble with escaping characters, assuming a \ before each character works