Notice: Undefined variable
<p>With <code>error_reporting(E_ALL)</code>; removed, my script works fine, however when I uncomment it, the following notice appears:</p>

<blockquote>
  <p>Notice: Undefined variable: messages in /home/www/test/register/html/form_1.html.php on line 11</p>
</blockquote>

<p>form_1.html.php:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta name="generator" content=
          "HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org"&gt;
    &lt;title&gt;Sign in or Register&lt;/title&gt;
  &lt;/head&gt;


  &lt;body&gt;
  &lt;p&gt;&lt;?php displayMessages($messages) ?&gt;&lt;/p&gt;&lt;!-- line 11 --&gt;
</code></pre>

<p>On line 11 there is a function call, which basically iterates over an array argument:</p>

<pre><code>function displayMessages($array)

{
    if (!empty($array) &amp;&amp; isset($array))
    {
        foreach ($array as $number =&gt; $error)
        {
            echo '&lt;font size="3" color="#990000"&gt;' . "* $error" . "&lt;/font&gt;&lt;/br&gt;";
        }    
    }
    elseif (empty($array) || !isset($array) )
    {
        echo "";
    } 

    elseif (empty($array) || !isset($array))
    {
        $array = array();
        $array = null;
    }

}
</code></pre>

<p>I've added the if condition to check if its empty, because sometimes I will pass an empty array.</p>

<p>This is a small part of these three files, it's supposed to be a registration form:</p>

<ul>
<li>index.php</li>
<li>output.php</li>
<li>form_1.html.php</li>
</ul>

<p>All found here ( <a href="http://pastie.org/1062886" rel="nofollow">http://pastie.org/1062886</a> )</p>

<p>The index file checks if the user has filled in out the values and validates them, however if they haven't it'll place an error in the respective error array, the display error function is supposed to display them if there are values in the array passed to it.</p>

<p>I bet the solution is pretty basic, but I am a noob and its making me pull my hair out.</p>
