Jump to content

Undefined index


kvnirvana

Recommended Posts

I've got this on my page index.php

 

$rand = $_SESSION['rand'];
if (empty($rand)) {
srand((float)microtime()*1000003);
$rand = rand();
$_SESSION['rand'] = $rand;
}

 

On all my other pages i've got this

 

<?php unset($_SESSION['rand']) ?>

 

The problem is that if I go to any other page than index it will unset the session 'rand'. If I then go back to index.php I get this error 'Notice: Undefined index: rand'

 

is there a way to get around this?

 

Link to comment
https://forums.phpfreaks.com/topic/218654-undefined-index/
Share on other sites

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.