Jump to content

Variables initialize everytime I go to a page


Recommended Posts

it is not? why is user_id null (Notice: Undefined index: user_id in) when I go to b.php the second time then?


The first time it shows 1 as it should but from the second time it becomes undefined.

I think I found my problem....On my page b.php I also had a logout option. Which means that if I press a button my session is destroyed.


and I did it that way:

<button class="btn btn-primary" type="submit" onclick="myFunction()"> </button>

function myFunction(){


So php is interpreting my php code even if it's inside a javascript function that wasn't called. That's why that guy warned me about using javascript and php!

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.