I'm saving on some values using $_SESSION
.
<?php
session_start();
include_once '../controller/LocacaoController.php';
if(!empty($_REQUEST['idfilme']) and !empty($_REQUEST['idfita'])){
$idfilme = $_REQUEST['idfilme'];
$idfita = $_REQUEST['idfita'];
$_SESSION['codfilme'] = $idfilme;
$_SESSION['codfita'] = $idfita;
echo "entrou aqui";
}
else {
if(!empty($_SESSION['codfilme']) and !empty($_SESSION['codfita'])){
$_SESSION['codfita'] = null;
$_SESSION['codfilme'] = null;
}
}
?>
The code is as follows: if in my other file I pass values to $_REQUEST['idfilme']
and $_REQUEST['idfita']
then it enters IF
and saves to session, Now if $_REQUEST
is empty it goes to ELSE
and adds% with% as NULL
and $_SESSION['codfita']
Then in another file I retrieve these values:
<?php
session_start();
include_once '../controller/LocacaoController.php';
$idCliente = $_SESSION['cliente'];
$idFita = $_SESSION['codfita'];
$idFilme = $_SESSION['codfilme'];
var_dump($idFita);
var_dump($idFilme);
if(!empty($_SESSION['codfita'])){
$idFita = $_SESSION['codfita'];
$idFilme = $_SESSION['codfilme'];
}
?>
But the problem is that even though I pass values to $_SESSION['codfilme']
and $_REQUEST['idfilme']
and entering $_REQUEST['idfita']
of code 1, on the other screen it is returning IF
.
NOTE: Do not worry about null
, and the connection of the files because it is working properly, the problem is $_REQUEST
.