This is what I had been using as the check based on the code that had been
there previously and along with an email validator that sets $email to ""
if the address isn't valid. The purpose of the form is lead generation. The
last bit is to prevent spammers from entering urls in the class text box.
iif (($name == "") || ($email == "") || ($phone =="") || ($city=="Select
your city") || ($class=="") ||
preg_match("/[^A-Za-z0-9-\\s\\(\\)\\?\\:\\;@\\.™\\,\\–\\&'\\t]/uis",
$class))
{...}
Does this do the same thing as isset? Would isset be better?
April
On Sun, Jun 17, 2012 at 7:41 PM, James <[email protected]> wrote:
> Same logical check with my personal preference ;)
>
> $toaddress = $mapping['default'];
>
> if ( isset($city) && isset($mapping[$city]) ) { ... }
>
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> Jim Lucas <[email protected]> wrote:
>>
>> On 6/15/2012 3:29 PM, Joshua Kehn wrote:
>> > Way easier to just use a map.
>> >
>> > $mapping = array(
>>
>> > 'Calgary' => "abc@emailaddress",
>> > 'Brooks' => "def@emailaddress",
>> > // etc
>> > );
>> > $toaddress = $mapping[$city];
>>
>> I would use this, but add a check to it.
>>
>> $mapping = array(
>> 'default' => '[email protected]',
>> ...
>> );
>>
>> ...
>>
>> if ( isset($mapping[$city]) ) {
>> $toaddress = $mapping[$city];
>>
>> } else {
>> $toaddress = $mapping['default'];
>>
>> }
>>
>> Jim
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>