Maar weer overnieuw gestart met mijn TCPDF script en bovenaan staat dan controle op variabelen.

<?php
$Error = 'False' ;
$sqlCombiWHERE = " ";
$report = $_GET['report']; // report name/template
if($_GET[Type] == "stable") {
        $sort = ", 2010Combination.stableNumber ";
        }
elseif($_GET[Type] == "combination")
    {
        $sort = ", 2010Combination.compNumber ";
        }
elseif($_GET[Type] == "nocell")
    {
        $sqlCombiWHERE = " WHERE 2010Combination.cellGroom IS NOT NULL ";
        $sort = " ";
    }
else {
    $Error = 'True';
}
?>

Het script wordt als volgt aangeroepen:

script.php?Stables&stable|combination|nocell

Vraag, is dit de juiste werkwijze??
1: het is $_GET['Type'], niet $_GET[Type].
2: Je kunt iets als dit doen:
<?php
$Error = false;
$sqlCombiWHERE = ' ';
$report = $_GET['report'];
switch ($_GET['Type']) {
case 'stable':
$sort = ', 2010Combination.stableNumber ';
break;
case 'combination':
$sort = ', 2010Combination.compNumber ';
break;
case 'nocell':
$sqlCombiWHERE = ' WHERE 2010Combination.cellGroom IS NOT NULL ';
$sort = ' ';
break;
default:
$Error = true;
break;
}
?>

Reageren