Jump to content

cannot set session variable


anp241

Recommended Posts

Is there some reason you are making that setting in you htaccess file? It's not technically needed to do what your post title suggests. To set a session var you simply assign a value to it just as you would for any php variable. Of course, as Joel states, you have to first start the php 'session' with the session_start() command. Place this at the top of all of your scripts as a habit so that you always have access to it.

 

<?php
session_start();
..
..
..
$_SESSION['myvar'] = "this value";
..
..

 

That's all there is to it. There are other things that come into play when you are being extremely security conscious or need to do some kinds of deception, but for your defined needs this is all you need.

Archived

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.