Skip to content
Advertisement

Equivalent of Alert() and Prompt() in PHP

In JavaScript, we have Alert() and Prompt() which open up a popup box for the user.

Is there an equivalent for PHP? $Get_['asdf'] is one way to get user input… any others?

Also, one more question. Is it a requirement that PHP always be executed all at once? Or can it be like JavaScript, where it waits for the user input (e.g. popup box), then executes the rest of the code after that.

Advertisement

Answer

PHP is a server side language, it can’t do alert messages on the client side. But you can use javascript within the php to do the alert.

JavaScript

For Prompt you can do something like this –

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement