Re: Problem with header in an if

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay Blanchard wrote:
[snip]

	/* send the errors to the interface and exit*/
	if('' !== $errorsReported){
		for($i = 0; $i < count($errorsReported); $i++){
			echo $errorsReported[$i];
		}

unset($errorsReported); print_r($errorsReported);

	} else {
	/* reload the empty interface */


a quick echo statement here to check that this block is running when
you expect it to might tell you something... but you have probably
already plastered your code with echo/print statements to determine the
flow :-)
[/snip]

Well, the array still appears, it is empty and unset (see modified code
above) does not get rid of it. Here is how it comes back ....
Array ( [0] => [1] => [2] => [3] => )

Well maybe its just me, but you are comparing an array with a string if ('' !== $errorsReported), which doesn't make any sense. Try this instead:


if (is_array($errorsReported))
{
   echo implode("",$errorsReported);
} else {
   header(....);
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux