Hi,
Is it possible to use PHP within a JavaScript If..Then. I am trying to have a confirm button come up and if the users say yes to the confirm button steps will be carried out if they say no they won’t. This is the code i tired (i got the message a run-time error has occured):-
if (isset($_POST[‘submit’])) {
?>
<script language=”JavaScript”>
var agree=confirm(“Are you sure you want to log out of the inventory system”);
if (agree) {
</SCRIPT>
<?php
if (isset($_POST[‘UserDelete’] > 0))) {
$a=$
$i=0;
foreach ($a as $v) {
$query = “DELETE FROM users WHERE user_id = $a[$i]”;
mysql_query($query) or die (mysql_error());
$query = “DELETE FROM tasks WHERE user_id = $a[$i]”;
mysql_query($query) or die (mysql_error());
$i++;
}
}
}
?>
<SCRIPT>
}
</SCRIPT>