I'm trying to go to the deleteQns.php
page from my code, but I can't seem to go there as I'm always redirected back to administrator(Quiz2)
. I don't know what's wrong. I hope you all will be able to help me.
Here is my code:
<?php while($row=$ result->fetch_array(MYSQLI_ASSOC)) { ?>
<tr class="size">
<form id="button" action="administrator(Quiz2).php" method="post">
<th>
<p>No.
<?=$row[ "questionid"]?>
</p>
</th>
<th>
<?=$row[ "questiontext"]?>
</th>
<th class="editanddelete">
<input type="hidden" name="qid" value="<?=$row[" questionid "]?>">
<input type="submit" value="Edit" name="editbtn">
</form>
<form id="delete" action="deleteQns.php" method="post">
<button onclick="myFunction()">Delete</button>
<input type="hidden" name="qid" value="<?=$row[" questionid "]?>">
<p id="demo"></p>
<script>
function myFunction() {
var x;
if (confirm("Are You Sure You Want To Delete This Question?") == true) {
window.location = "deleteQns.php";
} else {
x = "";
}
document.getElementById("demo").innerHTML = x;
}
</script>
</form>
<?php } ?>