-2

I have a log in in page where by when I i log in it takes me to my homepage which has a <div class="alert alert-success> message. I want this message to show for like 5 seconds then it fades out. How do I do that?? Also when i refresh my page I don't want the message to show again unless i log out then log in again.

this is some of the code: × success! Login successfull! This is supposed to show when i have successfully logged in.

DannieP
  • 11
  • 2
  • Do you have a database ? – Ivan Jul 19 '16 at 23:22
  • 2
    You should really add some code. In the meantime, I should point you to [cookies!](http://www.w3schools.com/php/php_cookies.asp) Create a cookie when a user logs in and use [Javascript in PHP](http://stackoverflow.com/questions/10596218/how-to-write-javascript-code-inside-php) to keep the alert-success message hidden. – Harshul Sahni Jul 19 '16 at 23:27

1 Answers1

0

You could use php to create set a session variable and then clear it after it's been displayed.

session_start();
$_SESSION['new_message'] = true;

if(isset($_SESSION['new_message']){
//your code to display the message
session_destroy;
}

To fade after 5 seconds use jquery

$('#div').delay(5000).fadeOut(400)