Hi All!

  I have a simple function that returns a message:

function showError ($mensagem)
{
    return '<div class="erro">' . $mensagem . '</div>';
}

  And this is how I use it:

if (isset($_SESSION['forum']['error']['insert'])) {
    echo showError($_SESSION['forum']['error']['insert']));
}

  But I want that when the function is used the session variable is
destroyed. A simple unset($mensagem) inside showError() gives me back this:

Warning: Undefined variable: mensagem in
c:\www\lib\sistema\formularios\formularios.inc.php on line 92

  I would not like to put an unset() inside if (isset($_SESSION....)), after
the function is called, since that only adds another line in my script, and
['error'] is an array with several other values. I have tried passing it as
a reference the function argument but the error persists.

  So:

  How can I destroy the session variable inside showError($_SESSION)?

  Thanks for any tips,


--

Julio Nobrega.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to