0

When the return button is clicked, I need it to redirect to fine_payment.php page. I've tried header() but it shows: Cannot modify header information - headers already sent..

<form action="fine_payment.php" method="post">
     <button type="submit" name="return" id="submit" class="btn btn-info">Return Book </button>
     <input type="hidden" name="return_id" value="<?php echo $row['rid']; ?>"> 
</form>

At the same time , i need to run this POST code:

if(isset($_POST['return'])){
    $id = $_POST['return_id'];
    $query = "SELECT * FROM issue_books WHERE id= $id ";
    $query_run = mysqli_query($connection,$query);

    while($row = mysqli_fetch_assoc($query_run))
    {
        $issue_date = strtotime($row['book_issue_date']);
        $due_date = strtotime($row['book_due_date']);
        $return_date = strtotime(date('Y-m-d'));

        $days_diff = $return_date - $due_date;
        if($days_diff >=0)
        {
            $_SESSION['day'] = floor($days_diff/(60*60*24));
        }
    }
}
SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Carol H
  • 37
  • 5

0 Answers0