unkown
unkown

Reputation: 31

PHP $_SESSION on form submit lost

I'm lossing the session when I submit a form, until them I kept loged in my code.

I'm sending the session values through the form in that way, but it does not work at all:

<input type='hidden' name='loged' value='".$_SESSION["loged"]."'>
<input type='hidden' name='role' value='".$_SESSION["role"]."'>

Is that right?

Thanks you

of course before I get loged, I alredy worte this on the code:

session_start();

Upvotes: 0

Views: 1028

Answers (2)

sdolgy
sdolgy

Reputation: 7001

You are submitting the form ... if you do a phpinfo(); you'll see that the inputs have now arrived as value under $_REQUEST ... If you want to access the session variables again, you need to:

  • session_start();
  • print_r($_SESSION);

You'll see your session vars again.

Upvotes: 0

Ben
Ben

Reputation: 305

wrong way, you don't need to submit values already set in session

Upvotes: 2

Related Questions