Re: [PHP] states

2003-07-02 Thread Ray Hunter
On Tue, 2003-07-01 at 16:55, Matt Palermo wrote:
 Does anyone know of any built in functions or options for the US states?
Nope no built in function for this...

 I want to make a drop down menu and some other things which have the 50
 states in it.  Is there any shortcut for this with PHP, or do I need to
 do it all manually in HTML?  Please let me know.  Thanks.
You can create your own function to build this for you.

I have always put the 50 states in a database and used that for all my
html and output requirements. You can google state abbreviations and use
that in a database or file.

--
BigDog
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] states

2003-07-01 Thread Andrew McCombe

 Does anyone know of any built in functions or options for the US states?
 I want to make a drop down menu and some other things which have the 50
 states in it.  Is there any shortcut for this with PHP, or do I need to
 do it all manually in HTML?  Please let me know.  Thanks.

 Matt


Hi Matt,

Short answer - No.  PHP Doesn't have ant short function to generate drop
down lists or menus. Your best bet is to look at
http://www.webreference.com/dhtml/hiermenus/ and build your HM_Arrays.js
from scratch (or 'borrow' the select box from other sites.)

Regards
Andrew

ps. as a European, I get very annoyed with the number of websites that ask
for address details and then only give State/County/Area options for US
states.  I know the U.S.A is big - but the rest of the world is bigger.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] states

2003-07-01 Thread Philip Olson
 Does anyone know of any built in functions or options for the US states?
 I want to make a drop down menu and some other things which have the 50
 states in it.  Is there any shortcut for this with PHP, or do I need to
 do it all manually in HTML?  Please let me know.  Thanks.

Here's one:
  http://px.sklar.com/code.html?id=164

Regards,
Philip


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] states

2003-07-01 Thread janet
In a message dated 7/1/2003 3:56:28 PM Pacific Daylight Time, [EMAIL PROTECTED]
writes:

Does anyone know of any built in functions or options for the US states?
I want to make a drop down menu and some other things which have the 50
states in it.  Is there any shortcut for this with PHP, or do I need to
do it all manually in HTML?  Please let me know.  Thanks.

Here's code that will create a dropdown list of states. It uses functions
called getNames and getCodes that create arrays of the state names and state
codes. The functions that create the arrays are attached. 

select name=state
  ?php
$stateName=getNames();  
$stateCode=getCodes();  
for ($n=1;$n=50;$n++)  
{
  $state=$stateName[$n];
  $scode=$stateCode[$n];
  echo option value='$scode';
  if ($scode== AL) 
 echo  selected;
  echo $state\n;
}
  ?
/select

Good luck,

Janet

  ?php
function getCodes()
{
$stateCode = array(1= AL ,
  AK ,
  AZ ,
  AR ,
  CA ,
  CO ,
  CT ,
  DE ,
  DC ,
  FL ,
  GA ,
  HI ,
  ID ,
  IL ,
  IN ,
  IA ,
  KS ,
  KY ,
  LA ,
  ME ,
  MD ,
  MA ,
  MI ,
  MN ,
  MS ,
  MO ,
  MT ,
  NE ,
  NV ,
  NH ,
  NJ ,
  NM ,
  NY ,
  NC ,
  ND ,
  OH ,
  OK ,
  OR ,
  PA ,
  RI ,
  SC ,
  SD ,
  TN ,
  TX ,
  UT ,
  VT ,
  VA ,
  WA ,
  WV ,
  WI ,
  WY );
return $stateCode;
}

function getNames()
{
  $stateName = array(1= Alabama, 
  Alaska, 
  Arizona, 
  Arkansas, 
  California, 
  Colorado, 
  Connecticut, 
  Delaware, 
  District of Columbia, 
  Florida, 
  Georgia, 
  Hawaii, 
  Idaho, 
  Illinois, 
  Indiana, 
  Iowa, 
  Kansas, 
  Kentucky, 
  Louisiana, 
  Maine, 
  Maryland, 
  Massachusetts, 
  Michigan, 
  Minnesota, 
  Mississippi, 
  Missouri, 
  Montana, 
  Nebraska, 
  Nevada, 
  New Hampshire, 
  New Jersey, 
  New Mexico, 
  New York, 
  North Carolina, 
  North Dakota, 
  Ohio, 
  Oklahoma, 
  Ontario, 
  Oregon, 
  Pennsylvania, 
  Rhode Island, 
  South Carolina, 
  South Dakota, 
  Tennessee, 
  Texas, 
  Utah, 
  Vermont, 
  Virginia, 
  Washington, 
  West Virginia, 
  Wisconsin, 
  Wyoming);
return $stateName;
}
?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php