Forum Moderators: open
function ConfirmChoice()
{
answer = confirm("This will delete all data relating to this animal from the data base! This is irreversible. Are you sure you want to continue?")
if (answer!=0)
{
location = "path/to/php/script"
}
}
<form action="path/to/php/script" method="post" onSubmit=" ConfirmChoice(); return false;">
<input type="hidden" name="ds" value="delete">
<input type="hidden" name="itemID" value="<? $itemID?>">
<button type="submit">Delete</button></form>
My warning box pops up as expected, but when I click "OK" it appears that my post values are not being passed on to the script
Any direction to the solution would be greatly appreciated.
WBF
location = "path/to/php/script"
should be window.location. Also, there are a couple other things. Here is a revised code for you:
<script language="javascript" type="text/javascript">
function ConfirmChoice(adr)
{
answer = confirm("This will delete all data relating to this animal from the data base! This is irreversible. Are you sure you want to continue?")
if(answer)
{
adr.submit()
}
}
</script><form action="path/to/php/script.php" method="post" onSubmit="ConfirmChoice(this); return false;">
<input type="hidden" name="ds" value="delete">
<input type="hidden" name="itemID" value="<? $itemID?>">
<button type="submit">Delete</button></form>