• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in PHP by
How to pop an alert message box using PHP?

1 Answer

0 votes
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


alert("Hello World");

function alert($msg) {

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



Related questions

0 votes
asked Aug 19, 2019 in Selenium by rahulsharma
0 votes
asked Jun 22, 2019 in PHP by SakshiSharma