Error Message function

Posted by jasmine on Stack Overflow See other posts from Stack Overflow or by jasmine
Published on 2010-04-22T07:11:25Z Indexed on 2010/04/22 7:13 UTC
Read the original article Hit count: 348

Filed under:

I am trying to insert messages to a function

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

}

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

© Stack Overflow or respective owner

Related posts about php