0

Friends , i am not able to update the status of the table from my editpage where i passed my id from the previous page and by using that id i want to update my table which is not happening .Since i have kept Pending as default from my table is that the reason value in not updating ??

It executes the query but does not update my database

aadhar_card is the table.

session_start();

$aadhar_id=$_POST['aadhar_id'];

if(isset($_POST['submit']))
{

    $status=$_POST['status'];
    $update=$db->prepare('update aadhar_card  set status=:status where aadhar_id=:aadhar_id');
    $update->bindValue(':status',$status);
    $update->bindValue(':aadhar_id',$aadhar_id);
    $update->execute();
    if($update)
        header('location:formAdmin.php');//it is redirecting but not updating
    else
        echo 'not happening';
}
?>
<html>
<head></head>
<body>
<form action="" method="post">
<div class="col-md-4 col-md-push-5">
                    <select class="col-md-5" style="height: 5%;" name="status">

                      <option value="Accepted" >Accepted</option>

                      <option value="Pending" >Pending</option>

                      <option value="Rejected">Rejected</option>


                    </select>

                    <input type="submit" value="Update Status" name="submit">
                  </div>
                  </form>
</body>
</html>

i am getting the correct id from the previous page and i have passed it using hidden fields but not able to update."pending" is the default value in the table as soon as the form is filled by default "pending" value will be allocated to the form as the status and then it is changed here by admin from pending to accepted or rejected.

karan roy
  • 53
  • 7

0 Answers0