Have you included session_start() in the head of the file?
Session handling is not always easy: Related links here at WPW:
Disable session IDs in URL
php sessions for storing data
The best may be to learn OOP and write your own session class or
import one that is already finished.