Re: [PHP] Mystery foreach error

[email protected] (Matijn Woudt)
Newsgroups php.general
Message-ID <CAC_gtuNE5aEW9VAGnfzG-4Xv7aOSG-YC515bSHqKXHiArpE+gA@mail.gmail.com>
On Wed, Mar 13, 2013 at 5:07 PM, Jim Giner <[email protected]>wrote:

> On 3/12/2013 9:04 PM, Angela Barone wrote:
>
>> On Mar 12, 2013, at 5:16 PM, David Robley wrote:
>>
>>> Presumably there is a fixed list of State - those are US states? -
>>>
>>
>>  so why not provide a drop down list of the possible choices?
>>>
>>
>>         There is, but the problem must have been that if someone didn't
>> select a State, $state was blank.  I've since given the "Select a State..."
>> choice a value of 'XX' and I'm now looking for that in the if statement I
>> mentioned before.
>>
>> Angela
>>
>>  Why not just check if the $state exists as a key of the array $states
> before doing this?


Exactly, that's much better. It could be that some hacker enters something
other than XX or one of the states..
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.