Reputation: 3
I'm making a page that retrieves coordinates from a database and shows them as markers on google maps. I have a submit button that lets you delete a selected marker. What I'm trying to do is add a warning before deleting, but it unfortunately doesn't work. I've tried with onSubmit and with onClick (which is probably wrong anyway). I've been searching for hours but nothing seems to work. I don't think the rest of the code is important, but I'll post it if needed. Any ideas? Here's the code of the form:
echo '<form align="center" onSubmit="return confirm("Are you sure?")" class = "delete" id="delete_form" name = "marker_list2" action="delete_marker.php" method="post">';
echo '<input type="submit" value="Delete" name="edit">';
echo '</form>';
Upvotes: 0
Views: 528
Reputation: 3854
Looks like you've got conflicting double-quotes. Try replacing
onSubmit="return confirm("Are you sure?")"
with
onSubmit="return confirm(\'Are you sure?\')"
Make sure to escape the single quotes, because it is inside your PHP echo '...'
Upvotes: 3