문제

echo "<td><a onclick=\"confirm('Are you sure you want to permanently delete this post?');\" href='posts.php?id=".$res['id']."'>view</a></td>";

Generated with PHP, the confirm isn't popping up.. What am I doing wrong? Thanks for lookin.

도움이 되었습니까?

해결책

use

onclick="return confirm('Are you sure you want to permanently delete this post?');"

다른 팁

Try:

echo "<td><a onclick='return confirm('Are you sure you want to permanently delete this post?');' href='posts.php?id=".$res['id']."'>view</a>";

use instead:

echo "<td><a onclick="return confirm('Are you sure you want to permanently delete this post?');" href="posts.php?id=".$res['id']."'>view</a></td>";

confirm return true or false

Add return false or true to avoid further execution

    if(Confirm())
           return true;
        else
          return false;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top