I am trying to create a Delete-button with a user confirmation-pop-up.
HTML/PHP:
<form method='POST' onclick='return confirmDelete()'>
<button type='submit'>
Delete script
</button>
</form>
JavaScript:
<script type="text/javascript">
function confirmDelete() {
if (confirm("Are you sure?")) {
window.location.href = 'delete_script.php?<?php echo "$id" ?>';
return false;
}
else{
return true;
}
}
</script>
What it does is that it re-directs me to the correct page, "delete_script.php" but the $id does not appear in the url. The "delete_script.php"-page works with other pages, but I don't know what's wrong with this code. I really think it's possible. Any help would be appreciated!
$id
come from in the first place? – Ja͢ck Jan 5 '14 at 23:26