On 15/03/06, Roman Rumisek <[EMAIL PROTECTED]> wrote:
> Hi,
>
> this code fragment give following result in my error log:
>
> foreach($reg_array as $region_item)
>   $tmp_reg_array[] = $region_item[0];
> $sel_region = explode(',', $_POST[CLIENT_REGION]);
> foreach($sel_region as $sel_region_item)
>   if(!in_array($sel_region_item, $tmp_reg_array))
>   {
>     my_error_log("Unknown region: $sel_region_item, region array: ".
>                  var_export($tmp_reg_array, TRUE));
>     header("Location: ".
>       get_error_result(
>          $state_def[$_SESSION[STATE_VAR]][STATE_REDIR_PAGE])
>     );
>     exit;
>   }

It's more likely that you've got whitespace before or after the
region, especially if it's the last in the list that's always failing.
 Try trimming the region before passing it to in_array().

Have you ever considered using braces around loop blocks?

  -robin

Reply via email to