//this is in php
function msgbox($msg, $type)
{
if ($type == "alert")
{
// Simple alert window
?> <script language="JavaScript"> alert("<? echo $msg; ?>"); </script> <?
}
elseif ($type == "confirm")
{
// Enter Confirm Code Here and assign the $result variable for use
// Should include "OK" and "Cancel" buttons.
?>
<script language="JavaScript">
if (confirm("<? echo $msg; ?>"))
{
<? $result == "ok"; ?>
}
else
{
<? $result == "cancel"; ?>
}
</script>
<?
}
}
if ($page_title->exists())
{msgbox("page exists,do you want to delete", "confirm");
}
if ($result == "ok")
//code..
The problem is that $result
is not reading the value from the confirm box I think because the if clause is not being executed and the program flow is going where it would go without the if clause.