Place an array in a Session

Asked

Viewed 49 times

-2

Hello, I have an array with a lot of values I need to pass to a session, I’m trying this way:


array_push($array_tabela ,$tabela);
$_SESSION['tabela'] =  $array_tabela;

But the problem is when I take the session on another page this with only one element in the array array com apenas um elemento

  • 2

    Can mount a [mcve] demonstrating the problem?

  • Sure I’ll ride

1 answer

1

I recommend you to use $_SESSION['table']=json_enconde($array_table) to store and when to use the array again use the $_SESSION['table']=json_decode($array_table,true)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.