Second question in just a few minutes interval. As I said in my other post, I am learning, so I have a few questions 🙂
I want to create a function that will handle all the error messages generated by the site.
What I can't find a way to do is that, when I call the function, I want to call it like this : fnMessage('m001'). How can I do so when I call the function like this, it will read the content of the variable named $m001 ?
Here is the code of the function
function fnMessage($noMsg)
{
$m001 = "succes1";
$m002 = "succes12";
$m501 = "erreur1";
$m502 = "erreur2";
$no = substr($noMsg,1,3);
if ($no>=500)
{
$beginMsg = "<br><h3><img src=\"../art/msgSuccess.gif\" align=\"absbottom\"> ";
$endMsg = "</h3>";
}
else
{
$beginMsg = "<br><h3 class=\"Err\"><img src=\"../art/msgErr.gif\" align=\"absbottom\"> ";
$endMsg = "</h3>";
}
echo $beginMsg . 'WHAT_GOES_HERE_?' . $endMsg;
}
Any idea on how this could be done? I know it would be easier to just put in a db table, but I don't want to do it like that as I want it to be a reusable module for different projects.
Thanks,
Simo