blueman378 Posted January 1, 2008 Share Posted January 1, 2008 hi guys, i know there are codes out there in java to show/hide divs using a link, but my question is is this possible with php? i assume not as php is a before load sorta thing but figured id ask anyway Link to comment https://forums.phpfreaks.com/topic/83942-solved-i-knowthis-can-be-done-with-java-but-i-want-php/ Share on other sites More sharing options...
Stooney Posted January 1, 2008 Share Posted January 1, 2008 AJAX http://marc.info/?l=php-general&m=112198633625636&w=2 Link to comment https://forums.phpfreaks.com/topic/83942-solved-i-knowthis-can-be-done-with-java-but-i-want-php/#findComment-427172 Share on other sites More sharing options...
MikeDXUNL Posted January 1, 2008 Share Posted January 1, 2008 you could prob try something like this; main.php <?php $expandDiv1 = "exdiv1"; $expandDiv2 = "exdiv2"; $expandDiv3 = "exdiv3"; if($_COOKIE['expandDiv1'] == "exdiv1") { echo "<div><a href=\"navigation.php?collapseDiv1\">-</a>Collapse Div 1</div> echo "<div>sub div 1</div>"; echo "<div>sub div 2</div>"; } else { echo "<div><a href=\"navigation.php?expandDiv1\">+</a>Expand Div 1</div>"; } ?> navigation.php <?php $HTTP_REFERER = $_SERVER['HTTP_REFERER']; switch($_SERVER['QUERY_STRING']) { case 'expandDiv1': $expandDiv1 = "exdiv1"; setcookie('expandDiv1', $expandDiv1, time()+24000); header("Location: $HTTP_REFERER"); exit; break; case 'collapseDiv1': $expandDiv1 = "coldiv1"; setcookie('expandDiv1', $expandDiv1, time()+24000); header("Location: $HTTP_REFERER"); exit; break; /////////////////////////////////////// case 'expandDiv2': $expandDiv2 = "exdiv2"; setcookie('expandDiv2', $expandDiv2, time()+24000); header("Location: $HTTP_REFERER"); exit; break; case 'collapseDiv2': $expandDiv2 = "coldiv2"; setcookie('expandDiv2', $expandDiv2, time()+24000); header("Location: $HTTP_REFERER"); exit; break; } Link to comment https://forums.phpfreaks.com/topic/83942-solved-i-knowthis-can-be-done-with-java-but-i-want-php/#findComment-427176 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.