tester
tester

Reputation: 459

deleting a record just refreshing the page in php

Trying to delete a record but it is just refreshing the page.Deleting a record need to update the status to 0 but it is just refreshing the page not updating any data

<td>
   <a class="buttons delete" href="deletequestions.php?id='.$row['question_number'] .'">
      <i class="fa fa-trash"> </i>
   </a>
</td>   

Deletequestions.php

<?php
     session_start();
     include 'includes/db.php';
     $id=$_REQUEST['question_number'];
     $query1 = "UPDATE  questions set status='0' WHERE question_number=$id ";
     $result1 = mysqli_query($mysqli,$query1);
     header("Location: searchquestions.php");
?>

Questions DB Table:

questions_number text status

1 question1 1

2 question2 1

Choices DB Table:

id questions_number is_correct text status

1 1 0 question 1

2 1 1 question 1

3 1 0 question 1

4 2 0 question1 1

5 2 1 question2 1

6 2 0 question3 1

Upvotes: 0

Views: 33

Answers (1)

CCH
CCH

Reputation: 1536

The name of the variable you pass to the page is id not question_number in the url, as you used ?id=

$id=$_REQUEST['question_number'];

should be :

$id=$_REQUEST['id'];

Upvotes: 2

Related Questions