Hello,
I used to use below code to make it confirm.
echo "<td<a href=\\"makeAvailable.php?id=$id\\" onclick=\\"return confirm('Are you sure you want to share{$title}?');\\">Share this item</a></td>";
It worked fine until $title was “What’s so amazing?”
As you see, $title has ’ in that, so no confirm box is shown, just go to the makeAvailable.php right away.
Is there anyway I can solve this problem?
echo '<td><a href="makeAvailable.php?id='.$id.'" onclick="return confirm(\\'Are you sure you want to share '. addslashes($title) .'?\\')">Share this item</a></td>';
print ("<td><a href=\\"makeAvailable.php?id=$id\\" onclick='return confirm(\\"Are you sure you want to share $title?\\",alert(\\"eek a mouse!\\"))'>Squash this item</a></td>");