Jump to content

Dont display again


doddsey_65

Recommended Posts

Ive created a notice system which shows notices to the visitors of my forum. The thing is though I need a system where the logged in user can close the notice and not have it displayed again. What would be the best way to accomplish this? Would cookies be the best idea? Because that would mean setting a cookie for every notice that has been closed.As far as i can think of that's the only way. Any thoughts?

Link to comment
https://forums.phpfreaks.com/topic/244460-dont-display-again/
Share on other sites

store it in the database? Have one of two possible options, and in the notice system check whether it's the first or second option. If first option(default), show notices, otherwise if second option don't show them. Atleast then if they access your site from a different computer they won't have to close the notices again.

Link to comment
https://forums.phpfreaks.com/topic/244460-dont-display-again/#findComment-1255637
Share on other sites

You could probably create a table for the notifications and when the user clicks the "close" button it would send the word "hide" or whatever you want to the database so you can use a if statement to hide it.

 

Ex:

<?php

//When person clicks hide button
mysql_query("UPDATE notifications SET notification_type = '$notification_type', user = '$Session_or_Cookie', display = 'hide'") or trigger_error(mysql_error());

//then on the forum
$find = "SELECT notification_type, display FROM notifications WHERE user = '$Session_or_Cookie'";
$run = mysql_fetch_assoc(mysql_query($find)) or trigger_error(mysql_error());

$notification = $run['notification_type'];
$display = $run['display'];

if($display = "hide"){

}else{

echo "
$notification
";

}

?>

Link to comment
https://forums.phpfreaks.com/topic/244460-dont-display-again/#findComment-1255639
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.