Joomla has an internal message system, which queues up pieces of information to relay back to user. You can push messages to the end of this queue very simply

In some cases you will not need to access this queue as you can simply used the setRedirect() method of a controller etc which can take a message as one of it’s arguments. But in other cases when a setRedirect() cannot be used, you can push a message to the queue via the JApplication object. This object is part of Joomla core and contains a lot of api functions; one being enqueueMessage. So to add a message to the queue:

JFactory::getApplication()->enqueueMessage('Your message goes here');

Happy coding.