Forum Moderators: open
php variable declaration code ends here.
?>
<html>
<head>
<script language="JavaScript">
<!-- Begin
var agree=confirm("Check to confirm correctness. CANCEL to go back.\nCourse = <? echo "$coursename";?>");
if (agree)
document.write("");
else
history.go(-1);
// End -->
</script>
</head>
<body>
</body>
</html>
<? php code starts to make connection etc.
document.write(agree);
after the Confirm request, then if this returns what you expect. use document.write(agree) within the if statement to ensure that it's not the If statement that's causing you an issue. But from the code you've entered above, all appears fine.
PS - This was tested on IE7 so unless this is a browser specific issue the above holds true.
<script language="JavaScript">
<!-- Begin
function formconfirm() {
return confirm("Check to confirm correctness. CANCEL to go back.\nCourse = <? echo "$coursename";?>");
}
// End -->
</script>
<form action="whatever.php" onSubmit="return formconfirm()">
...
</form>