Foreach loop; Undefined index: position. Syntax appears correct though
<p>I'm getting an <code>undefined index: position</code> error using the code below, yet I do not see any errors in anything that I am doing. Looks just like the example on the php page (<a href="http://php.net/manual/en/control-structures.foreach.php" rel="nofollow">http://php.net/manual/en/control-structures.foreach.php</a>) :</p>

<pre><code>$position_list = array(
1 =&gt; "Chair", 
2 =&gt; "SACA",
5 =&gt; "School",
0 =&gt; "Disabled",
);

foreach ($position_list as $priv_id=&gt;$position) {
    $data['position'] .= '&lt;option value="'.$position_list[$priv_id].'"'; //throws error here
     if ($position_list[$priv_id] == $privilege_id) {
            $data['position'] .= " selected=\"selected\""; 
        }
     $data['position'] .= '&gt;'.$position.'&lt;/option&gt;';   //throws error here
}   
</code></pre>

<p>I commented the code where the errors are thrown.</p>

<p>Edit: $data['position'] is a whole different thing, it is not suppose to refer to the position used in the foreach array.</p>

<p>Edit2: Some more code. Here is what is at the end of this php file:</p>

<pre><code>$page-&gt;html .= File::text_replacement( "add_user.inc", $data );
</code></pre>

<p>In a add_user.inc file I have a line like this:</p>

<pre><code>&lt;td&gt;&lt;select name="privilege_id"&gt;%%position%%&lt;/select&gt;&lt;/td&gt;
</code></pre>

<p><code>%%position%%</code> will be replaced by the $data['position'] variable upon the File class being called. This is not meant to be $position. </p>
