how to insert PHP code snippet in javascript

Posted by Piyush on Stack Overflow See other posts from Stack Overflow or by Piyush
Published on 2010-05-19T07:46:00Z Indexed on 2010/05/19 7:50 UTC
Read the original article Hit count: 175

Filed under:
|

my code-

<?php

session_start();
$_SESSION['errors']="failed";
?>

<head>

function myfunc()
{        
     alert(<?php echo $_SESSION['errors']; ?>);
}

</head>

<body onload="myfunc();">

but alert msg is not popping up.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript