• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

Php syntax. Want to use Msgbox instead of 'echo' or 'print'

Normally I would use an echo statement for any work.  What I'd like to do for one piece is to use a message box command instead.

My ultimate goal is when a button is pressed it comes up with a little windows-esque message box.

Is there anything like msgbox?
1 Solution

You can use JavaScript to pop up a message box


alert("TEXT HERE");

Beverley PortlockCommented:
PHP is a server-side language whereas you are talking about a client-side facility. PHP has no "MSgBox" command. Having said that you could take the "alert" command in javascript and emulate a msgBox like so

$error = "some message or other";
.. more code


.... HTML code ....

        <script type='javascript'>
             if ( $error != "" )
                 echo "alert('$error')\n";
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now