简体   繁体   中英

confirm dialog box in php

I have this echo statement:

echo "<td align=center style=border:0>"."<a href='?delete=$row[id]'>Delete</a>"."</td>";

how am I able to make that when I press the 'Delete' a yes no dialog box will appear?

I've read somewhere that it can add some thing like this somewhere in the statement:

onClick="javascript:return confirm(\'Are you sure you want to delete this record?\')"

Any help would be appreciated. thanks in advance.

Try this:

echo "<td align=center style=border:0><a onclick='return confirm(\"Are you sure you want to delete this record?\")' href='?delete=$row[id]'>Delete</a></td>";

I got rid of the unnecessary "." in your original code.

Just Use this

echo "<td align=center style=border:0><a onclick='return confirm(\"Are you sure you want to delete this record?\")' href='?delete=$row[id]'>Delete</a></td>";

Instead of

echo "<td align=center style=border:0>"."<a href='?delete=$row[id]'>Delete</a>"."</td>";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM