I'll try to explain my problem:
I have 4 DIV's which can be toggled visible or hidden. If I show one div, the other close. If I show another div, the first close and so on.
Only one DIV can have display:visible at the time.
I have the DIV's ID numbers from a for-loop, and I have a SESSION-check to see if a DIV have a radiobutton which is checked.
If the radiobutton for any of my 4 div's are checked, then set display:visible on that DIV <-- this works!
But the first time the page loads, I want the first DIV to be display:visible. And the other div's to be closed.
If the page loads again, and a DIV is checked, then do NOT show the first div as visible.
Maybe it's easier with some code:
This set's a SESSION as soon as one of the radiobutton are checked.
The variable is used within the code for the "make radiobutton"
$checked1 = ($selection[$i]['id'] == $_SESSION['payment'] ? true : false);
This checks to see if one of the radiobuttons are checked:
<?php
if ($checked1 == 1) {
$divStyle = "display: visible";
} else {
$divStyle = "display: none";
}
?>
This is the DIV's code (all of them are in a for-loop of course
<DIV style="<?php echo $divStyle; ?>; background:#f0f1f4; float:left; width:1053px; padding:20px; margin-bottom:10px; border: dashed 1px #3b5bae;" CLASS="toggle" id="<?php echo $i; ?>">
I understand why none are checked at the first pageload, but how can I make the first DIV have display:visible, first time page loads?
Hope this was understandable, I'm not good at saying much with little ;)