我想知道单击了哪个链接,以便可以相应地显示页面内容。 这是我所拥有的:
第一页:
<script>
function click(index){
if (index == 'Requests')
document.cookie = "clicked="+ index +";path=/";}
</script>
<?php
foreach ($boxData as $index => $element){
echo " <a href=$element onclick=click($index)><div id='blue_box'></div>
<div id='grey_box'>$index</div></a>";}
?>
第二页:
if ($_COOKIE['clicked'] == 'Requests'){
$boxData_2 = array (
"List of request" => "",
"Make a New Request" => "",
"List of Employee Request" => ""
);}
else if ($_COOKIE['Assets']){
$boxData_2 = array (
"Add a new Assets" => "",
"List of Assets" => "",
);
}
错误是 未定义索引:已点击
我在做什么错?
提前谢谢。