$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
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) {
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';
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,
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
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
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
7 matches
Mail list logo