Create a Confirm Dialog box in PHP?

I am working on an admin page which displays all the data in my db. The admin can update rows or delete rows. I am looking for some advice or coding tips to create a dialogue prompt box if possible in PHP or javascript which will confirm an action like: “Are you sure you want to delete file?”

Much like on myphpadmin when you click on the drop icon, a promt box will appear before deleting a file.

Any suggestions?

ok I found a javascript… however I am having a hard time implimenting the java code into php. Here is what I have.

In the head tag I have my java script:

[code][/code]

in the php section I have this code:

echo '<td class="style6"><a href="javascript:decision("Do you want to delete this file?", ","delete.php?id='.$rows['id'].'">Delete</a>';"</td></tr>";

But when I click on the delete link - nothing happens. In the status bar of my browser in says “Error on Page”
Can someone tell me what I am doing wrong?

What’s the ‘Error on page’ error message that you’re receiving? You have to keep in mind that java is not javascript, they’re two different things.

Thanks for the reply. I finally figured it out last night. The php code for anyone who might want it is:

echo'<td><a href="delete.php?id='.$rows['id'].'"onclick="javascript:return confirm('Are you sure you want to delete this file?')">Delete</a>';"</td></tr>";

Feel free to modify it.

Does it pass text variables ?

Sponsor our Newsletter | Privacy Policy | Terms of Service