Upadate Session Variable

I’m a newbie with PHP here, so take it easy on me. Heres my problem:

I just coded a pretty extensive form that post to my database and works pretty well. I also wrote this bit of code within the php file that’s inserting my information into the correct db:

	$getmyformid = mysqli_insert_id($dbc);
	// echo "$getmyformid";
	$_SESSION ['formid'] = $getmyformid;

This grabs the id of the entry that it just inserted and puts it into a session variable. After you click submit it goes to a thank you page that is the same page just with a thanks message and then I have a header refresh:

if (isset($_POST['new-project'])) {
$getmyformid = mysqli_insert_id($dbc);
header( "refresh: 2; url=http://pf.lcbcchurch.com/project.php?formid=$getmyformid");

I was hoping this would put the entry id in the url so I could pull up the actual entry in the project.php page. However, it actually pulls the previous version of the session variable then I need. Is there any way to update the session variable or a better way to go about this then I am currently? Let me know, thanks!

try: PHP: session_write_close - Manual

before you do header(loc…

That just gave me an id of zero.