How should I make variable global for all the pages in PHP
<p><strong>Question</strong></p>

<p>I want to make <code>$associate_name</code> and <code>$app_key</code> global variable so I can access them on any page I want. Below is the code from my header file and the get variables are coming to index page. It works fine on index page as the $_GET data is available but when a user moves onto next page but with the same header file included it throws an error saying <strong>Undefined index</strong>. Please let me know how can I make this variable available on all pages. Thanks!</p>

<p><strong>Code</strong></p>

<pre><code>$associate_name = $_REQUEST['an'];
$app_key = $_REQUEST['key'];
define('associate_name',$associate_name);
define('app_key',$app_key);

//echo "Sorry but there seems to be a problem in your code. We can't find one of the following: App name or App key";           

$select_associate = "SELECT * FROM associate_account WHERE associate_name='".associate_name."' and app_key='".app_key."'";
$assoc_result = mysql_query($select_associate) or die($select_associate.mysql_error());

if(mysql_num_rows($assoc_result)&lt;=0){
    echo "Oops there seems to be a problem in your iFrame code. Please login into your Associate panel and copy/paste the link again.";
}else{
    $row_assoc = mysql_fetch_assoc($assoc_result);
    $associate_name=ucwords($row_assoc['associate_name']);
    $app_logo=$row_assoc['app_logo'];
    $app_intro_content=$row_assoc['app_intro_content'];
    $bg_color=$row_assoc['bg_color'];
}
</code></pre>
