Hello everyone !

How to make conditional messagebox in PHP?

How do I do it? Like for example, in deleting record inside the database. The user will be asked to input costumer_ID (there should be a button named "search") if the user pressed the button search, it will search through the database and if the record found, messagebox will appear "Delete this Record?" option will be "YES" and "NO". If the user choose "YES" record will be deleted. If the user choose "NO", it will load the page where the user asked to input costumer_ID.

Is there anyone who can help? PLEASE !!!

Thank's in advance.

Edited by amulet_john: n/a

7 Years
Discussion Span
Last Post by pzuurveen

You need a bit of javascript. You could escape out of php and just have the javascript but this example does it as an echo.

echo "
<script language=\"Javascript\">
var answer = confirm (\"Confirm the Delete of Record $ref_num\")

This passes the response to the alert box to the program that will process the delete / database update or whatever restricted operation you are using this to control.


Thanks for your reply crishea.

I try to use your code but it didn't work.

Is there any other way to do it? Just simple one. Thanks !

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.