Switch / isset assistance
Posted: Wed May 25, 2005 6:55 pm
Hi Gang,
I'm getting the following error :
Undefined variable: action in auaddsummary.php on line 250
I fixed most of these with if (isset) code but not $action
Also, is there a more efficent way to code the following?
Could these all be in a switch?
TIA, Will.
I'm getting the following error :
Undefined variable: action in auaddsummary.php on line 250
I fixed most of these with if (isset) code but not $action
Also, is there a more efficent way to code the following?
Could these all be in a switch?
TIA, Will.
Code: Select all
//Receive click from buttons
if (isset($_GET['action'])) {
$action = ($_GET['action']);
}
if (isset($_POST['addSummary'])) {
echo '<pre>'; print_r($_POST); echo "<h1>Submitted to DB</h1><br>"; echo "</pre>";
}
if (isset($_POST['viewFaceStock'])) {
view($_POST['stockId']);
}
if (isset($_POST['addFaceStock'])) {
viewAddFaceStock();
}
// Action popup code
echo "<script language=\"javascript\">var newWindow = window.open
('".$_SERVER['PHP_SELF']."?action=viewFaceStock&stockId=".$stockId."','',
'scrollbars=yes,status=yes,windowX=10,windowY=10,width=440,height=550')</script>";
}
// Switch
switch($action) {
case "viewFaceStock": fnViewFaceStockSpec(); break;
case "viewAddFaceStock": fnAddFaceStock(); break;
case "viewAdhesive": fnViewAdhesive(); break;
case "addAdhesive": fnAddAdhesive(); break;
case "viewLiner": fnViewLiner(); break;
case "addLiner": fnAddLiner(); break;
case "addFs": fnCreateFs(); break;
case "addFaceStock": viewAddFaceStock(); break;
default: viewFaceStockSummary(); break;
}