I have two banners on the same page and I want to display just one at a time, each time I refresh the page it should display the other one. The containers of the two banners have a specific class called "cta1" and "cta2". Unfortunately, it does not alternate. The PHP code looks like this:
<?php
$time = strtotime(date('Y-m-d 23:59'));
if(isset($_COOKIE['cta'])){
    if($_COOKIE['cta']=='two') {
        echo '<style>.cta2{display:block !important;}</style>';
        echo '<style>.cta1{display:none !important;}</style>';
        setcookie('cta', 'one', $time+186400, '/');
    }else{  
        echo '<style>.cta1{display:block !important;}</style>'; 
        echo '<style>.cta2{display:none !important;}</style>';
        setcookie('cta', 'two', $time+186400, '/');
    }
}else{
    setcookie('cta', 'two', $time+186400, '/');
    echo '<style>.cta1{display:block !important;}</style>';
    echo '<style>.cta2{display:none !important;}</style>';
}
?>
The HTML code looks like this:
<div class="cta1">banner 1</div>
<div class="cta2">banner 2</div>
