header() will not redirect to the page I wanted. There are no error msgs and header function works fine in Xampp but not in production web-server.
What I'm trying to accomplish is that in the table of links, when I click on APR button, the STATUS column changes to "Approved" immediately. This work in localhost environment but not in production server.
I've already tried ob_start and ob_end_flush, I've also checked if there are any white spaces or lines.
I also removed "./" preceding index.php.
// this is the reservation.php
if (isset($_GET['apr'])) {
$rsID = $_GET['apr'];
$query = $conn->query("UPDATE reservations SET reservStatus = True WHERE
reservID = $rsID");
header("location: ./index.php");
}
// this is the index.php
<?php
require 'header.php';
if (isset($_SESSION['user_info'])) {
include 'reservation.php';
} else {
include 'login.form.php';
}
include 'footer.php';
I expected it would redirect to the index.php and from there, if session has been started, it would direct the page back to reservation.php