Modal Bootstrap - php | Jquery | Hidden

Asked

Viewed 70 times

0

Good night, you guys. Could someone ask me a question... I have User’s birthday data that comes from the database, made a if to compare if the current date is equal to the day of the logged-in user’s birthday in the system:

if($stringReplace == date('m-d')){
   echo $this->element('modalAniversario'); 
}

so if it’s like he calls a Modal(Bootstrap) to wish happy birthday, only that there is the problem if the person clicks on the button "Close" modal, it keeps showing up all the time because it gets in this if every time, my question is have some possibility not to appear more the modal as soon as one click on the Button type a Hidden in the modal class when clicking on the button "Close".

1 answer

1


Hello, use cookie to store data in browser, https://www.w3schools.com/php/php_cookies.asp

Example:

if($stringReplace == date('m-d') && !isset($_COOKIE['aniversario']){
    echo $this->element('modalAniversario'); 
    setcookie('aniversario', true);
}

This way it will appear only once.

  • Perfect, buddy, that’s right, it worked out very well Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.