Error Message function
<p>I am trying to insert messages to a function</p>

<pre><code>function addMessage($item) {
     if ($result) {
      $message =  '&lt;p class="ok"&gt;
                    &lt;span&gt; Item added &lt;/span&gt;
                   &lt;/p&gt;
                  ';
                  header("Refresh: 2; url=?page=$item");
        }
        else{
            $message = '&lt;p class=not&gt;&lt;span&gt;There is an error blah blah&lt;/span&gt;&lt;/p&gt;';
        }
        return $message;
</code></pre>

<p>}</p>

<p>When I use it : addMessage('contents') it only returns to second condition. How can I fix this?</p>
