RE: [PHP] simplify if/then statement

2002-04-27 Thread Stuart Dallas
$incfilename = Calc.$state..class.inc; if (file_exists($incfilename)) include($incfilename); else echo Please select a State.br\n; -- Stuart -Original Message- From: Jim Long [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 20:00 To: php Subject: [PHP] simplify if/then

Re: [PHP] simplify if/then statement

2002-04-27 Thread Jason Wong
On Sunday 28 April 2002 02:59, Jim Long wrote: Hi, I've got the following statement for a state options menu. How can this be expressed in a simple manner for all 52 states? //choose state if ($state == AL) { // include class include(CalcAL.class.inc); } else if ($state == AR) {

Re: [PHP] simplify if/then statement

2002-04-27 Thread Miguel Cruz
On Sat, 27 Apr 2002, Jim Long wrote: I've got the following statement for a state options menu. How can this be expressed in a simple manner for all 52 states? switch(strtolower($state)) { case 'al': include 'CalcALclass.inc'; break; case 'ar': include 'CalcALclass.inc';

RE: [PHP] simplify if/then statement

2002-04-27 Thread Philip Olson
I'd do something similar to this, along with putting all states in an array to make sure $state is actually a state (in_array). And maybe you want to add guam :) a) be sure $state is set, else load default b) be sure $state is not bogus, else yell at them c) be sure the $state file exists,

Re: [PHP] simplify if/then statement

2002-04-27 Thread Pekka Saarinen
Hi, Make an array $arr of all the states and loop $state = AR; $arr = array(); array_push($arr, AL, AR, AZ); foreach ($arr as $key = $value) { if ($state == $value){ include(Calc$value.class.inc); } } Cheers, Pekka http://photography-on-the.net/ At 4/27/2002, you wrote: Hi, I've

RE: [PHP] simplify if/then statement

2002-04-27 Thread Miguel Cruz
On Sat, 27 Apr 2002, Philip Olson wrote: I'd do something similar to this, along with putting all states in an array to make sure $state is actually a state (in_array). And maybe you want to add guam :) As an early Christmas present, here's the array (to save the OP some typing - I'm

Re: [PHP] simplify if/then statement

2002-04-27 Thread Jim Long
Using pull down for $state. This works great! $incfilename = Calc.$state..class.inc; if (file_exists($incfilename)) include($incfilename); else echo Please select a State.br\n; Thanks To Everyone, j -- http://jimlong.net/web I'd do something similar to this, along