Richard Korts
asked on
php switch statement
See following:
switch(intval($_POST['ua'] )) {
case ">=1":
$_SESSION['height'] = $_POST['bdepth'];
$_SESSION['width'] = $_POST['bwidth'];
$_SESSION['length'] = $_POST['blength'];
$_SESSION['cuft'] = $_POST['tsqft'];
$qryu = "UPDATE visitor set height = " . $_SESSION['height'] . ", width = " . $_SESSION['width'] . ", length = " . $_SESSION['length'] . ", cuft = " . $_SESSION['cuft'] . " where vid = " . $_SESSION['vid'];
echo "qryu = " . $qryu . "<br>";
$resu = mysqli_query($link, $qryu);
$_SESSION['step'] = "2";
break;
case ">=2":
$_SESSION['filt'] = $_POST['filt'];
$qryu = "UPDATE visitor set filtertration = " . $_SESSION['filt'] . " where vid = " . $_SESSION['vid'];
$resu = mysqli_query($link, $qryu);
$_SESSION['step'] = "3";
break;
}
I have this code in an instance where I know that the value of $_POST'ua'] is 1.
It does not execute the case ">=1".
Is this an illegal expression for "case"?
Thanks
switch(intval($_POST['ua']
case ">=1":
$_SESSION['height'] = $_POST['bdepth'];
$_SESSION['width'] = $_POST['bwidth'];
$_SESSION['length'] = $_POST['blength'];
$_SESSION['cuft'] = $_POST['tsqft'];
$qryu = "UPDATE visitor set height = " . $_SESSION['height'] . ", width = " . $_SESSION['width'] . ", length = " . $_SESSION['length'] . ", cuft = " . $_SESSION['cuft'] . " where vid = " . $_SESSION['vid'];
echo "qryu = " . $qryu . "<br>";
$resu = mysqli_query($link, $qryu);
$_SESSION['step'] = "2";
break;
case ">=2":
$_SESSION['filt'] = $_POST['filt'];
$qryu = "UPDATE visitor set filtertration = " . $_SESSION['filt'] . " where vid = " . $_SESSION['vid'];
$resu = mysqli_query($link, $qryu);
$_SESSION['step'] = "3";
break;
}
I have this code in an instance where I know that the value of $_POST'ua'] is 1.
It does not execute the case ">=1".
Is this an illegal expression for "case"?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.