我正试图在我的页面attach.php中包含几个不同的php包含文件,根据单击的链接,这些文件每次显示1个包含文件。
这是我的链接:
<a href="attach.php?tab=insurance"><div class="hewden_square"></div><h33>Insurance Documents</h33></a>
<a href="attach.php?tab=policy"><div class="hewden_square"></div><h33>Policy Documents</h33></a>
接下来我有我的php代码,它检查哪个链接被点击了。
<?php
switch(isset($_GET['tab'])) { //switch is just like a bunch of if()s
default: //default case
case '': //default case
include('include/attachments_overview.php'); //include page.html
break; //break, witch means stop
case 'insurance': // page2, if changePage has the value of page2
include('include/upload_insurance/upload_files.php'); //include page2.html
break; //break, witch means stop
case 'policy': // page2, if changePage has the value of page2
include('include/upload_policy/upload_files.php'); //include page2.html
break; //stop it
} //end the switch
?>
我的默认包含文件应该在点击任何链接之前显示,这是:
include('include/attachments_overview.php');
则根据点击哪个链接,应该包括一个或另一个。出于某种原因,我的默认包含文件显示为预期,而我的其他包含文件
include('include/upload_insurance/upload_files.php');
当我单击attach.php链接时显示?tab=保险
然而,当我点击我的最后一个链接attach.php时?tab=保单这似乎只是显示了我的保险标签的相同包含文件
include('include/upload_insurance/upload_files.php');
有人能告诉我哪里出了问题,或者给我一个更好/更可靠的方法吗?感谢
<?php
$tb = isset($_GET['tab']) ? $_GET['tab'] : '';
switch($tb) { //switch is just like a bunch of if()s
default: //default case
include('include/attachments_overview.php'); //include page.html
break; //break, witch means stop
case 'insurance': // page2, if changePage has the value of page2
include('include/upload_insurance/upload_files.php'); //include page2.html
break; //break, witch means stop
case 'policy': // page2, if changePage has the value of page2
include('include/upload_policy/upload_files.php'); //include page2.html
break; //stop it
} //end the switch
?>