Re: [PHP] else if vs switch

2012-06-18 Thread April Mains
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.

Re: Re: [PHP] else if vs switch

2012-06-18 Thread James
Original Message From: April Mains aprilma...@gmail.com To: Cc: PHP-General list php-general@lists.php.net Sent: Mon, Jun 18, 2012, 9:41 AM Subject: Re: [PHP] else if vs switch This is what I had been using as the check based on the code that had been there previously and along

Re: [PHP] else if vs switch

2012-06-18 Thread April Mains
On 2012-06-18, at 7:59 AM, James wrote: Original Message From: April Mains aprilma...@gmail.com To: Cc: PHP-General list php-general@lists.php.net Sent: Mon, Jun 18, 2012, 9:41 AM Subject: Re: [PHP] else if vs switch This is what I had been using as the check based on the code

Re: [PHP] else if vs switch

2012-06-18 Thread Ashley Sheridan
April Mains aprilma...@gmail.com wrote: On 2012-06-18, at 7:59 AM, James wrote: Original Message From: April Mains aprilma...@gmail.com To: Cc: PHP-General list php-general@lists.php.net Sent: Mon, Jun 18, 2012, 9:41 AM Subject: Re: [PHP] else if vs switch This is what I had

Re: [PHP] else if vs switch

2012-06-17 Thread Jim Lucas
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' =

Re: [PHP] else if vs switch

2012-06-17 Thread James
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 li...@cmsws.com wrote: On 6/15/2012 3:29 PM, Joshua Kehn wrote: Way easier

[PHP] else if vs switch

2012-06-15 Thread April Mains
I have 25 cities and am currently using the following to set the $toaddress for submitting student pre-registration forms based on the city selected: if ($city == Calgary) { $toaddress = abc@emailaddress; } elseif ($city == Brooks) { $toaddress = def@emailaddress; and so on. Would

Re: [PHP] else if vs switch

2012-06-15 Thread Joshua Kehn
Way easier to just use a map. $mapping = array( 'Calgary' = abc@emailaddress, 'Brooks' = def@emailaddress, // etc ); $toaddress = $mapping[$city]; Regards, –Josh Joshua Kehn | @joshkehn http://joshuakehn.com On Jun 15, 2012, at 6:20

Re: [PHP] else if vs switch

2012-06-15 Thread April Mains
Ah yes that's it. Thank you for your help. Have a good weekend. April On 2012-06-15, at 4:29 PM, Joshua Kehn wrote: Way easier to just use a map. $mapping = array( 'Calgary' = abc@emailaddress, 'Brooks' = def@emailaddress, // etc ); $toaddress = $mapping[$city];

Re: [PHP] else if vs switch

2012-06-15 Thread James Yerge
On 06/15/2012 06:44 PM, April Mains wrote: Ah yes that's it. Thank you for your help. Have a good weekend. April On 2012-06-15, at 4:29 PM, Joshua Kehn wrote: Way easier to just use a map. $mapping = array( 'Calgary' = abc@emailaddress, 'Brooks' = def@emailaddress, //