Jump to content

[SOLVED] i knowthis can be done with java but i want php...


blueman378

Recommended Posts

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;
}

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.