I have a PHP code and I use some JavaScript code inside just for alerting some text and a variable that I defined inside my PHP code.
How can I use my PHP variable in my JavaScript code to display it with an alert?
Code:
<?php
$a="Jhon";
$b=true;
if($b)
{
echo "
<script type=\"text/javascript\">
alert('Hello'.$jhon);
</script>
";
}
?>