keep getting udefined variable for an array
<p>I keep getting undefiendd variable for steps in <code>Text5.php</code> when accessing <code>Text2.php</code>. My question is how come I amgetting an undefined variable as I have included the variable <code>$steps</code> as an array:</p>

<p>Text5.php</p>

<pre><code>    &lt;?php

$steps = array(1 =&gt;'Text1.php',2 =&gt; 'Text2.php',3 =&gt; 'Text3.php',4 =&gt; 'Text4.php',5 =&gt; 'Text6.php',6 =&gt; 'Text7.php');

function allowed_in($steps){
// Track $latestStep in either a session variable
// $currentStep will be dependent upon the page you're on

if(isset($_SESSION['latestStep'])){
   $latestStep = $_SESSION['latestStep'];
}
else{
   $latestStep = 0;
}
$currentStep = basename(__FILE__); 

$currentIdx = array_search($currentStep, $steps);
$latestIdx = array_search($latestStep, $steps);

if ($currentIdx - $latestIdx == 1 )
    {
       $currentIdx = $_SESSION['latestStep'];
       return 'Allowed';
    }
    return $latestIdx;
}

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

<p>Text2.php</p>

<pre><code>            if (allowed_in()=== "Allowed")
    {
        //Text2.php code
    }
    else
        {
$page = allowed_in()+1;
?&gt;

&lt;div class="boxed"&gt;
&lt;a href="&lt;?php echo $steps[$page] ?&gt;"&gt;Link to Another Page&lt;/a&gt;
&lt;/div&gt;

&lt;?php   

}

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