Example #1:
<a href="this-file.php?action=case1">Case1</a> | <a href="this-file.php?action=case2">Case2</a> | <a href="this-file.php?action=dummy">Dummy</a>
<?php
switch ($action)
{
case "case1" :
echo " This is case1 ";
break;
case "case2" :
echo " This is case2";
break;
case "dummy" :
// do something
break;
}
?> complete Switch-Case-Menu: check 'n try | download
Example #2:
<a href="this-file.php?action=look">FileExplorer</a>
<?php
switch ($action)
{
case "look" : // look for files
$handle=opendir('.');
while ($file = readdir ($handle)) {
if ($file != "." && $file != "..")
{echo "<a href='$PHP_SELF?action=delete&file=$file'>[Delete]</a> $file \n,
";}
}
closedir($handle);
break;
case "delete" :
unlink("$file");
echo "$file deleted!";
break;
}
?>