Mystery foreach error

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

 



	I've been getting the following error for awhile now, but I can't figure out why it's happening:

Invalid argument supplied for foreach() in ... sample.php on line 377

	Here's that portion of code:

include("states_zipcodes.php");

// Check if Zip Code matches from states_zipcodes
$zip_short = substr($zip, 0, 3);
foreach ($states[$state] as &$zip_prefix) {   // <-- line 377
    if ($zip_prefix == $zip_short) {
        break;
    } else {
        $match = 'no';
    }
}

	It doesn't happen all the time, so I'm thinking that some spambot is populating the HTML form with something the script doesn't like(?).  However, I tested that myself by entering text, or by entering just 2 digits, but there was no error.  FYI, I do have code in the script that catches faulty input and warns people in their browser to go back and re-enter the correct data, so I'm at a loss as to why this is happening.

	How can I see what's triggering this to happen?  I have the following line in my php.ini:

error_reporting = E_ALL & E_STRICT & E_NOTICE & E_DEPRECATED

Thank you,
Angela
-- 
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