How to Pop an Alert message Box Using PHP

admin_img Posted By Bajarangi soft , Posted On 03-12-2020

An alert box is used in the website to display a warning message to the user that they have entered the wrong value other than what is required to fill in that position. An alert box can still be used for friendlier messages. The alert box gives only one button “OK” to select and proceed. The alert message just like a pop-up window on the screen. Using this you can alert to the user with some information and message. PHP doesn’t support alert message box because it is a server-side language but you can use JavaScript code within the PHP body to alert the message box on the screen.

alret message box using php

Syntax:

alert("Message")
Program 1: PHP program to pop up an alert box on the screen.

<?php 
// PHP program to pop an alert 
// message box on the screen 

// Display the alert box 
echo '<script>alert("Welcome to software company")</script>'; 

?> 

Program 2: PHP program to pop up an alert box on the screen.

<?php 
// PHP program to pop an alert 
// message box on the screen 

// Function defnition 
function function_alert($message) { 
    
    // Display the alert box 
    echo "<script>alert('$message');</script>"; 



// Function call 
function_alert("Welcome to Ignite Software company"); 

?> 

 

Related Post