Session variable disappears after using the insert function
I have on my site where I display the username as a session variable in the header of the website. When I navigate between the pages, the session variable remains, but on one of my pages I am using a modal box with a form inside. When the user clicks on the submit button the insert function is saving the data to the database, but that username session variable disappears but the logout function is still visible on the website.
The weird thing is if I remove the insert function and then hit the submit button, of course the page doesn't do anything but refresh, but the session variable does not disappear. On another page where I have an update function, the session variable does not disappear.
Do you have any idea what this could be?