I'm trying to use a switch construct to compare the result of a form
with a list of known values and display a different page according to
the submitted string. The problem is that some of the answers I need to
check for are strings of the character zero of varying length:
E.g.
<?php
switch (trim(strtolower($_POST['answer']))):
case "abc":
case "xyz":
case "0":
include 'close.htm';
break;
case "0000000000":
include 'vclose.htm';
break;
default:
include 'sorry.htm';
endswitch;
?>
What happens is that a submission consisting of a string of any number
of zeroes cause the first page to be displayed rather than the second. I
thought this was because it was treating it as an integer 0, so I tried
putting (string) casts all over the place, which didn't help.
Could someone please tell me how to achieve what I want?
--
Steve Loft