Javascript Alert Box in PHP
Alert box in webpage is used to alert the user of the webpage. PHP is a sever side scripting language, so it can’t able to do alert box in client side( browser), this is the reason why we are integrating javascript in php coding.
First type of alert box by alert(“”);
1 2 3 4 5 |
<script type='text/javascript'>
alert("This is alert box 1");
</script>
|
Second type of alert box window.alert(“”);
1 2 3 4 5 |
<script type='text/javascript'>
window.alert("This is alert box 1");
</script>
|
Here is the coding, How Javascript is integrated with PHP coding? and displaying php values in javascript alert box.
$value is used inside the javascript
1 2 3 4 5 6 7 8 9 |
<html>
<body>
<?php
$value=2500;
echo "<script type='text/javascript'> alert('The value of Computer is".$value." INR'); </script>";
?>
</body>
</html>
|
Output for the above PHP and Javascript coding.






Thx for your share, this is usefull for this page