vendredi 13 décembre 2019

PHP | Variable not working inside If statement

I managed to get variable that I would like to use for further processing. Unfortunatly, I can't use is inside that if statement. Can someone nswer me why ?

$location = " ";
$persons = " ";
    if (isset($_GET['filter'])) {
        $_SESSION['filter'] = "start";
        $location = $_GET['destination'];
        $checkin = $_GET['checkin'];
        $checkout = $_GET['checkout'];
        $adults = $_GET['adults'];
        $children = $_GET['children'];

        $persons = $adults + $children;

        $query = "SELECT * FROM hotels WHERE location LIKE '$location%' AND persons >= $persons";
        $results = mysqli_query($db, $query);
    }
echo $location; // Working
    if (isset($_SESSION['filter']) && (isset($_GET['highest']))) {
        echo $location; // Not working
        echo "example"; // Working
    }

Aucun commentaire:

Enregistrer un commentaire