0 votes
in PHP by
How to pop an alert message box using PHP?

1 Answer

0 votes
by
PHP renders HTML and Javascript to send to the client's browser. PHP is a server-side language. This is what allows it do things like INSERT something into a database on the server.

But an alert is rendered by the browser of the client. You would have to work through javascript to get an alert. Below piece of code can certainly do that

<?php

alert("Hello World");

function alert($msg) {

    echo "<script type='text/javascript'>alert('$msg');</script>";

}

?>
...