Learn, How to open or pop up and alert message box using PHP.


Example

Let's create a PHP file and put the following code to show an alert in PHP


<?php

// Display the alert box  
$alert = '<script>alert("Hello Alert Message!")</script>';
echo $alert;

?>

The above example will create an alert box when you reload the page. We are using script tag in PHP as string PHP echo the javascript code and shows an alert message on the screen.


I hope it will help you ....