in PHP by
Q:
How to pop an alert message box using PHP?

▼ Show 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>";

}

?>
Learn More with Madanswer

Related questions

0 votes
asked Aug 19, 2019 in Selenium by rahulsharma
...