sametch
02-28-2003, 05:07 PM
I am trying to use a switch function to display a different text message according to the numeric value of a variable. It keeps missreading zeros and treating them as ones. Is there something obvious I am missing?
here is my code
switch ($pagetype)
{
case $pagetype == 0:
echo "Standard";
break;
case $pagetype == 1:
echo "Custom (using include)";
break;
case $pagetype == 2:
echo "External Link (same window)";
break;
case $pagetype == 3:
echo "External Link (new window)";
break;
default:
echo "Standard";
}
if I pass it the variable $pagetype when it equals 0 It responds with "custom (using include)"
sametch :confused:
here is my code
switch ($pagetype)
{
case $pagetype == 0:
echo "Standard";
break;
case $pagetype == 1:
echo "Custom (using include)";
break;
case $pagetype == 2:
echo "External Link (same window)";
break;
case $pagetype == 3:
echo "External Link (new window)";
break;
default:
echo "Standard";
}
if I pass it the variable $pagetype when it equals 0 It responds with "custom (using include)"
sametch :confused: