PHP "confirm" function?
| From: | Alarion | Date: | Sun, 14 Jan 2001 20:45:14 +0000 |
| Subject: | PHP "confirm" function? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5855@lists.php.net to get a copy of this message | ||
Ok, I am trying to add a "yes"/"no" dialog for a delete operation and I was
attempting this via the javascript "confirm" function, but no matter if I
click yes or no, the php code block still executes. I tried this way:
---------------------------------------------------------
<script language="javascript">
if(!confirm("Are you sure you wish to delete this section? This will delete
all llamas in this section as well!!")) {
document.location.href="llama.php3";
} else{
<?php
$db = NewDatabase("MySQL", "fusion", "5xc7hn3", "fusion",
"localhost");
$db->open();
if(!$db->execute("delete from lf_llamas where lfl_lfs_id = $id"))
die(print $db->geterror() . " while deleting from lf_llamas.");
if(!$db->execute("delete from lf_sections where lfs_id = $id")) die(print
$db->geterror() . " while deleteing from lf_sections.");
$db->close();
?>
}
document.location.href="llama.php3";
</script>
---------------------------------------------------------
thinking that the second code block would not be executed if they clicked
"no".
Does PHP have a native function for yes/no dialogs? I searched the docs and
couldn't find anything :(
Any help would be appreciated!
Sean Finkel