I want to use a php variable in my javascript.
I am not able to execute such a script..
I need to pass a php variable to a javascript function .Is that possible ?
If so,hw cn i implement this?
Thanks in adv
With regards
phpuser123
Code:
<script type='text/javascript'>
function display_alert(x){
alert(x);
}
</script>
<body>
<?php $var1='phpvariable';
echo "<button onclick='display_alert($var1)'>Diaplay alert</button>";
?>
</body>
I need to pass a php variable to a javascript function .Is that possible ?
If so,hw cn i implement this?
Thanks in adv
With regards
phpuser123
Comment