how to add popup message in php code example

Example 1: php pop up message

Copy Code<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Alert Box by PHP</title>
<script type="text/javascript">  function openulr(newurl) {  if (confirm("Are you sure you want to open new URL")) {    document.location = newurl;  }}</script></head>
<body>
<strong><a href="javascript:openulr('newurl.html');">Open new URL</a></strong>
</body>
</html>

Example 2: php pop up message

Copy Code<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Alert Box by PHP</title>
<?php
function_alert("We welcome the New World");

function function_alert($msg) {
    echo "<script type='text/javascript'>alert('$msg');</script>";
}
?>
</head>
<body>
</body>
</html>

Tags:

Php Example