How to show an alert box in PHP? [closed]
use this code
echo '<script language="javascript">';
echo 'alert("message successfully sent")';
echo '</script>';
The problem was:
- you missed
"
- It should be
alert
notalery
Try this:
Define a funciton:
<?php
function phpAlert($msg) {
echo '<script type="text/javascript">alert("' . $msg . '")</script>';
}
?>
Call it like this:
<?php phpAlert( "Hello world!\\n\\nPHP has got an Alert Box" ); ?>