I'm sure I don't need sessions - why the value is empty?

Hello all,

Please help me out.
This as been working, and I haven’t use sessions.

After some changes… and because I’m not using any version control system, and end up losing them.

But I’m sure I haven’t use sessions.

I have this page with two forms and one submit button each.
One with a get method to receive information. “Get Info Button”
The other with a post method to send information. “Save Info Button”

I’m not using any ajax at all.

The excerpt: (please not the comments)

$roidInfo = '';
$nomeDominio ='';
   if (isset($_GET['infoDominio']))
   {
     $nomeDominio = filter_input(INPUT_GET, 'nomeDominio', FILTER_SANITIZE_STRING);
     $dominioVo->setNome($nomeDominio);
     try 
     {
       ...
      $roidInfo = isset($infoDominio['roid']) ? $infoDominio['roid'] : '';
     }
     catch (EppCommandsExceptions $e)
     {
       ...
     } 

     //all well here, I get the dump with values:
     //var_dump($nomeDominio);
     //var_dump($roidInfo);
    }
    if (isset($_POST['atualizarDominio']))
    {
      var_dump($nomeDominio); //dump ""
      var_dump($roidInfo); //dump ""

Why is this? I’m sure this is been working without sessions. :frowning:

On the first dump, I do get the values.
On the second dump, I don’t.

:frowning:

This must be something really basic, almost sure of it.

K. Regards,
Márcio

The trials lead me to this:

I was doing unset to my sessions at the end of the document. I had two submits there SO:
a) for the first submit (the GET) I had my sessions.
b) (then were then unset and the script ended)
c) on the second submit (the POST) script loaded again, my sessions were unset.

Still, I was unable to solve this. And, apparently, unable to explain it properly. :slight_smile:

Let’s trial a lot.
M.


<?php session_start(); ?>

<?php
 $roidInfo = '';
 $nomeDominio ='';
            
 if (isset($_GET['infoDominio']))
 {
    $nomeDominio = '123';
    try 
    {
      //...
      $roidInfo = '456';

      $_SESSION['nomeDominio'] = $nomeDominio;
      $_SESSION['roidInfo'] = $roidInfo;

      //retrieving the values. OK.
      var_dump($_SESSION['roidInfo']);
      var_dump($_SESSION['nomeDominio']);
     }
     catch (EppCommandsExceptions $e)
     {
       //...
     }
 }

 if (isset($_POST['atualizarDominio']))
 {
    //retrieving index undefined. not ok.
    var_dump($_SESSION['nomeDominio']);
    var_dump($_SESSION['roidInfo']);


    //all the rest... runs
 }

?>

Now with sessions, I still can’t retrieve them, so the problem must rely on something else…

@All - I have change $nomeDominio and $roidInfo to work with SESSIONS instead. I store the values on a session on $_GET[‘infoDominio’] and I try to retrieve them on $_POST[‘atualizarDominio’].
I get undefined index on the later. :frowning:

So, the problem must rely on something else right? :confused: