Getting an "undefined index" error
<p>I'm making an activation page that is getting mailed to the user after they register to the website, but i'm having an error in my code: </p>

<pre><code>Undefined index: ActivationKey
</code></pre>

<p>the link the user will get will be like</p>

<pre><code>website-url/activate.php?Username=user&amp;ActivationKey=foobar
</code></pre>

<p>it gives the error on this line of code:</p>

<pre><code>$ActivationKey = $_SESSION['ActivationKey'];
</code></pre>

<p>my code is the following: </p>

<pre><code>&lt;?PHP



//Include database connection details
require_once('config.php');

//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag = false;

//Connect to mysql server
$link = mysql_connect("127.0.0.1","root","XXX");
if(!$link) {
    die('Failed to connect to server: ' . mysql_error());
}

//Select database
$db = mysql_select_db("monitron");
if(!$db) {
    die("Unable to select database");
}


//Start session
session_start();    


//check if Username is already in session and
//use it if it is
//else, grab it from GET
//use it from GET
if(!empty($_SESSION['Username'])){
$Username = $_SESSION['Username'];
}else if(isset($_GET['Username'])){
$_SESSION['Username'] = $_GET['Username'];
$Username = $_SESSION['Username'];
};


//Grab activationkey from session.

if(isset($_GET['ActivationKey'])){
$_SESSION['ActivationKey'] = $_GET['ActivationKey'];
};

$ActivationKey = $_SESSION['ActivationKey'];

echo $ActivationKey;
echo $Username;

//Create update query to update activation status
$qry = "UPDATE login SET ActivationStatus = 'Active' WHERE Username = '$Username'";
$result = @mysql_query($qry)

?&gt;
</code></pre>

<p>i'd appreciate it if somebody could help me out on this :)</p>
