I've been making steady progress up until the point I wanted the user to have a 'confirm' alert before deleting a row via PHP. Essentially, I need to pass the variable of the row's id number to the 'delete.php' page once the user has pressed 'ok'.
So the PHP prints out a button:
$clickid = $db_field['id'];
print "<form><input type='button' onclick='confirmation()' value='Delete'></form>";
And my Javascript:
function confirmation() {
var answer = confirm("You wish to delete this event?")
if (answer){
alert("Deleted")
window.location = "http://www.xxxxxxx.co.uk/admin/delete.php<? "?id=$clickid "?>";
}
else{
alert("Your Event is Not Deleted")
}
}
</script>
It obviously runs through to the 'delete.php' page, but doesn't delete anything because $clickid seems to have no value passed to it. If anyone can spot where I am going wrong, or maybe something that would work, that would be great help.
set_error_reporting(E_ALL | E_STRICT)to check uninitialized var usage.