I've an internal server error and I think switch statement is the cause, because before adding it, I had not. Someone could help me please? Maybe using if construct I can resolve?
part of my main.php :
$.ajax({
type: "POST",
url: "callFunc.php",
data: { ciccio: app , alt:h , bas:b , spe:p },
success: function(msg) {
alert( "done!"+msg );
}
});
part of my callFunc.php :
$lav = $_REQUEST['ciccio'];
$alt = $_REQUEST['alt'];
$bas = $_REQUEST['bas'];
$spe = $_REQUEST['spe'];
switch ($lav){
case 'uno' :
case 'due' :
echo call_user_func('getPrice_'.$lav,$alt) ;
break;
case 'tre' :
case 'quattro' :
echo call_user_func('getPrice_'.$lav,$bas) ;
break;
case 'cinque' :
case 'sei' :
echo call_user_func('getPrice_'.$lav,$bas,$spe) ;
break;
default :
echo 'ERROR : Unexpected value!'
}