Nisa8 Posted January 5, 2011 Share Posted January 5, 2011 Hi, I'm new to php and just trying to practice with some codes I have. I have a php code to delete an entry from a database, all works well but I want to try to use the 'onclick' event to prompt for confirmation. However, when I add this I end up with a blank page. Then original code was: echo('<p>' . $commenttext . '<a href="adddelete.php?deletecomment=' . $commentid . '">' . 'Delete this Comment</a></p>'); I changed it to: echo('<p>' . $commenttext . '<a href="adddelete.php?deletecomment=' . $commentid . ' onclick='return confirm('Are you SURE you want to delete this comment?')'">' . 'Delete this Comment</a></p>'); Anyone know what the problem could be, or an alternative way to get a confirmation before deleting? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
rondog Posted January 5, 2011 Share Posted January 5, 2011 <?php echo("<p>" . $commenttext . "<a href=\"adddelete.php?deletecomment=" . $commentid . "\" onclick=\"return confirm('Are you SURE you want to delete this comment?')\">Delete this Comment</a></p>"); ?> Quote Link to comment Share on other sites More sharing options...
Nisa8 Posted January 5, 2011 Author Share Posted January 5, 2011 Thanks alot Rondog, that's working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.