coutts Posted August 5, 2008 Share Posted August 5, 2008 Hello: Could anyone tell me why the code below does not work ie no confirmation box. I have tested the code as plain HTML/javascript and the idea works when written like: <a href="delete.php?id=1" onclick="return confirm('Are you sure');">Delete</a> but I have clearly put it together wrong for PHP - I do know that probably it can be written with less joins "." but that is the only way I can "see" what I am doing at all. Thanks Robert echo( "<a href=\"delete.php?id=" . "$row['ID']" . "\"" . " \"return confirm('Are you sure');\">" . "DELETE" . "</a>" ); Link to comment https://forums.phpfreaks.com/topic/118278-solved-concatenating-a-line-of-code/ Share on other sites More sharing options...
.josh Posted August 5, 2008 Share Posted August 5, 2008 echo "<a href=\"delete.php?id={$row['ID']}\" onclick = \"return confirm('Are you sure');\">DELETE</a>"; Link to comment https://forums.phpfreaks.com/topic/118278-solved-concatenating-a-line-of-code/#findComment-608675 Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 Or: printf('<a href="delete.php?id=%d" onclick = "return confirm(\'Are you sure?\');">DELETE</a>', $row['ID']); Link to comment https://forums.phpfreaks.com/topic/118278-solved-concatenating-a-line-of-code/#findComment-608680 Share on other sites More sharing options...
coutts Posted August 5, 2008 Author Share Posted August 5, 2008 Thanks for both replies - I have tried them and found them both to be solutions - thanks Link to comment https://forums.phpfreaks.com/topic/118278-solved-concatenating-a-line-of-code/#findComment-608686 Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 No problem. Link to comment https://forums.phpfreaks.com/topic/118278-solved-concatenating-a-line-of-code/#findComment-608687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.