php yes no message box


Can some one tell me how to display yes no message box in php coded  like code below

message box can be javascript

if(isset($_GET["action"])) {
		  switch ($_GET["action"]) {
			case "del":

		//here message box "are you want to delete?" and if user click "yes" echo"Delete" if click "no" echo "No Delete"	    

			case "edit":
//here same message box for edit 


Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use JavaScript and the method confim(message) on your first page, before calling your php. Eg.
if (confirm(message)){
} else {
Somewhere else you probably have a link or a button. It is THERE that you need to do this, NOT on the php code you are pointing out:

<a href='#' onclick='retrun confirm("Are you sure you want to delete this item?") '>Delete</a>
In VBScript ( which will only work in Explorer ) you can try this:
<script language="VBScript">
Dim intAnswer
intAnswer = MsgBox("do you want only YES and NO?", vbYesNoCancel)

If intAnswer = 6 Then
   ' Yes.
ElseIf intanswer = 7 Then
   ' No
   ' Cancel
End If

Else, you can try to create a modal javascript box to encompass this.
nikola_mkAuthor Commented:
I use this code but message box did not  appear

            <td> <a  href='?action=del' onCLick='return confirm('Are you SURE you want to delete this record?')'> <img alt='del' src='delete_cell.jpg' title='del'  /> </a>

where I'm wrong?

you need double quotes around the entire onclick - ex:
onclick=" ... "

The reason you cannot use apostrophes is because your javascript statement already uses apostrophes:
<a  href='?action=del' onclick="return confirm('Are you SURE you want to delete this record?')"> <img alt='del' src='delete_cell.jpg' title='del'  /> </a>

The other way around this is to use double quotes in your javascript and leave the apostrophes in your onclick:

return confirm("Are you SURE you want to delete this record?")

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.