I'm creating a web-based mail client from scratch using PHP IMAP library. What I need to implement right now is fetch the error and display it in a fancy way(ex. pop up in the view when error occured). How am i going to do this?
This is a sample of what I tried to do but attained no success because a line(s) of error message(s) still display on the page.
try{
self::$conn = imap_open(self::$imappath, self::$mailuser, self::$mailpassword);
}
catch (Exception $e){
$_SESSION['imap_error']="IMAP connect failed.";
}
in my view I have this:
if (isset($_SESSION['imap_error']) && ($_SESSION['imap_error']!=""))
{
?>
<script type="text/javascript">
$('.classname').fadeIn('slow');
$('.span_name').html("<?php echo ($_SESSION['imap_error']);?>");
</script>
<?php
}
How am i goin to completely remove of the error message generated by php/imap and just return or pass my own error message [session] to my view?
Thanks for the help!