This simple snipt removes the mind blast of having to work with a select form of all country names (all 240 of them)!
3/1/06 Edit: Removed duplicate DB entries
Edit: Edited for a bit more clarity.
By : LLX
/*******in MYSQL*******/
CREATE TABLE `CountryList` (
`CountryID` int(11) NOT NULL auto_increment,
`Name` varchar(200) NOT NULL default '',
PRIMARY KEY (`CountryID`)
) TYPE=MyISAM AUTO_INCREMENT=242 ;
--
-- Dumping data for table `CountryList`
--
INSERT INTO `countrylist` VALUES (1, 'United States');
INSERT INTO `countrylist` VALUES (2, 'Canada');
INSERT INTO `countrylist` VALUES (3, 'Mexico');
INSERT INTO `countrylist` VALUES (4, 'Afghanistan');
INSERT INTO `countrylist` VALUES (5, 'Albania');
INSERT INTO `countrylist` VALUES (6, 'Algeria');
INSERT INTO `countrylist` VALUES (7, 'Andorra');
INSERT INTO `countrylist` VALUES (8, 'Angola');
INSERT INTO `countrylist` VALUES (9, 'Anguilla');
INSERT INTO `countrylist` VALUES (10, 'Antarctica');
INSERT INTO `countrylist` VALUES (11, 'Antigua and Barbuda');
INSERT INTO `countrylist` VALUES (12, 'Argentina');
INSERT INTO `countrylist` VALUES (13, 'Armenia');
INSERT INTO `countrylist` VALUES (14, 'Aruba');
INSERT INTO `countrylist` VALUES (15, 'Ascension Island');
INSERT INTO `countrylist` VALUES (16, 'Australia');
INSERT INTO `countrylist` VALUES (17, 'Austria');
INSERT INTO `countrylist` VALUES (18, 'Azerbaijan');
INSERT INTO `countrylist` VALUES (19, 'Bahamas');
INSERT INTO `countrylist` VALUES (20, 'Bahrain');
INSERT INTO `countrylist` VALUES (21, 'Bangladesh');
INSERT INTO `countrylist` VALUES (22, 'Barbados');
INSERT INTO `countrylist` VALUES (23, 'Belarus');
INSERT INTO `countrylist` VALUES (24, 'Belgium');
INSERT INTO `countrylist` VALUES (25, 'Belize');
INSERT INTO `countrylist` VALUES (26, 'Benin');
INSERT INTO `countrylist` VALUES (27, 'Bermuda');
INSERT INTO `countrylist` VALUES (28, 'Bhutan');
INSERT INTO `countrylist` VALUES (29, 'Bolivia');
INSERT INTO `countrylist` VALUES (30, 'Bophuthatswana');
INSERT INTO `countrylist` VALUES (31, 'Bosnia-Herzegovina');
INSERT INTO `countrylist` VALUES (32, 'Botswana');
INSERT INTO `countrylist` VALUES (33, 'Bouvet Island');
INSERT INTO `countrylist` VALUES (34, 'Brazil');
INSERT INTO `countrylist` VALUES (35, 'British Indian Ocean');
INSERT INTO `countrylist` VALUES (36, 'British Virgin Islands');
INSERT INTO `countrylist` VALUES (37, 'Brunei Darussalam');
INSERT INTO `countrylist` VALUES (38, 'Bulgaria');
INSERT INTO `countrylist` VALUES (39, 'Burkina Faso');
INSERT INTO `countrylist` VALUES (40, 'Burundi');
INSERT INTO `countrylist` VALUES (41, 'Cambodia');
INSERT INTO `countrylist` VALUES (42, 'Cameroon');
INSERT INTO `countrylist` VALUES (44, 'Cape Verde Island');
INSERT INTO `countrylist` VALUES (45, 'Cayman Islands');
INSERT INTO `countrylist` VALUES (46, 'Central Africa');
INSERT INTO `countrylist` VALUES (47, 'Chad');
INSERT INTO `countrylist` VALUES (48, 'Channel Islands');
INSERT INTO `countrylist` VALUES (49, 'Chile');
INSERT INTO `countrylist` VALUES (50, 'China, Peoples Republic');
INSERT INTO `countrylist` VALUES (51, 'Christmas Island');
INSERT INTO `countrylist` VALUES (52, 'Cocos (Keeling) Islands');
INSERT INTO `countrylist` VALUES (53, 'Colombia');
INSERT INTO `countrylist` VALUES (54, 'Comoros Islands');
INSERT INTO `countrylist` VALUES (55, 'Congo');
INSERT INTO `countrylist` VALUES (56, 'Cook Islands');
INSERT INTO `countrylist` VALUES (57, 'Costa Rica');
INSERT INTO `countrylist` VALUES (58, 'Croatia');
INSERT INTO `countrylist` VALUES (59, 'Cuba');
INSERT INTO `countrylist` VALUES (60, 'Cyprus');
INSERT INTO `countrylist` VALUES (61, 'Czech Republic');
INSERT INTO `countrylist` VALUES (62, 'Denmark');
INSERT INTO `countrylist` VALUES (63, 'Djibouti');
INSERT INTO `countrylist` VALUES (64, 'Dominica');
INSERT INTO `countrylist` VALUES (65, 'Dominican Republic');
INSERT INTO `countrylist` VALUES (66, 'Easter Island');
INSERT INTO `countrylist` VALUES (67, 'Ecuador');
INSERT INTO `countrylist` VALUES (68, 'Egypt');
INSERT INTO `countrylist` VALUES (69, 'El Salvador');
INSERT INTO `countrylist` VALUES (70, 'England');
INSERT INTO `countrylist` VALUES (71, 'Equatorial Guinea');
INSERT INTO `countrylist` VALUES (72, 'Estonia');
INSERT INTO `countrylist` VALUES (73, 'Ethiopia');
INSERT INTO `countrylist` VALUES (74, 'Falkland Islands');
INSERT INTO `countrylist` VALUES (75, 'Faeroe Islands');
INSERT INTO `countrylist` VALUES (76, 'Fiji');
INSERT INTO `countrylist` VALUES (77, 'Finland');
INSERT INTO `countrylist` VALUES (78, 'France');
INSERT INTO `countrylist` VALUES (79, 'French Guyana');
INSERT INTO `countrylist` VALUES (80, 'French Polynesia');
INSERT INTO `countrylist` VALUES (81, 'Gabon');
INSERT INTO `countrylist` VALUES (82, 'Gambia');
INSERT INTO `countrylist` VALUES (83, 'Georgia Republic');
INSERT INTO `countrylist` VALUES (84, 'Germany');
INSERT INTO `countrylist` VALUES (85, 'Gibraltar');
INSERT INTO `countrylist` VALUES (86, 'Greece');
INSERT INTO `countrylist` VALUES (87, 'Greenland');
INSERT INTO `countrylist` VALUES (88, 'Grenada');
INSERT INTO `countrylist` VALUES (89, 'Guadeloupe (French)');
INSERT INTO `countrylist` VALUES (90, 'Guatemala');
INSERT INTO `countrylist` VALUES (91, 'Guernsey Island');
INSERT INTO `countrylist` VALUES (92, 'Guinea Bissau');
INSERT INTO `countrylist` VALUES (93, 'Guinea');
INSERT INTO `countrylist` VALUES (94, 'Guyana');
INSERT INTO `countrylist` VALUES (95, 'Haiti');
INSERT INTO `countrylist` VALUES (96, 'Heard and McDonald Isls');
INSERT INTO `countrylist` VALUES (97, 'Honduras');
INSERT INTO `countrylist` VALUES (98, 'Hong Kong');
INSERT INTO `countrylist` VALUES (99, 'Hungary');
INSERT INTO `countrylist` VALUES (100, 'Iceland');
INSERT INTO `countrylist` VALUES (101, 'India');
INSERT INTO `countrylist` VALUES (102, 'Iran');
INSERT INTO `countrylist` VALUES (103, 'Iraq');
INSERT INTO `countrylist` VALUES (104, 'Ireland');
INSERT INTO `countrylist` VALUES (105, 'Isle of Man');
INSERT INTO `countrylist` VALUES (106, 'Israel');
INSERT INTO `countrylist` VALUES (107, 'Italy');
INSERT INTO `countrylist` VALUES (108, 'Ivory Coast');
INSERT INTO `countrylist` VALUES (109, 'Jamaica');
INSERT INTO `countrylist` VALUES (110, 'Japan');
INSERT INTO `countrylist` VALUES (111, 'Jersey Island');
INSERT INTO `countrylist` VALUES (112, 'Jordan');
INSERT INTO `countrylist` VALUES (113, 'Kazakhstan');
INSERT INTO `countrylist` VALUES (114, 'Kenya');
INSERT INTO `countrylist` VALUES (115, 'Kiribati');
INSERT INTO `countrylist` VALUES (116, 'Kuwait');
INSERT INTO `countrylist` VALUES (117, 'Laos');
INSERT INTO `countrylist` VALUES (118, 'Latvia');
INSERT INTO `countrylist` VALUES (119, 'Lebanon');
INSERT INTO `countrylist` VALUES (120, 'Lesotho');
INSERT INTO `countrylist` VALUES (121, 'Liberia');
INSERT INTO `countrylist` VALUES (122, 'Libya');
INSERT INTO `countrylist` VALUES (123, 'Liechtenstein');
INSERT INTO `countrylist` VALUES (124, 'Lithuania');
INSERT INTO `countrylist` VALUES (125, 'Luxembourg');
INSERT INTO `countrylist` VALUES (126, 'Macao');
INSERT INTO `countrylist` VALUES (127, 'Macedonia');
INSERT INTO `countrylist` VALUES (128, 'Madagascar');
INSERT INTO `countrylist` VALUES (129, 'Malawi');
INSERT INTO `countrylist` VALUES (130, 'Malaysia');
INSERT INTO `countrylist` VALUES (131, 'Maldives');
INSERT INTO `countrylist` VALUES (132, 'Mali');
INSERT INTO `countrylist` VALUES (133, 'Malta');
INSERT INTO `countrylist` VALUES (134, 'Martinique (French)');
INSERT INTO `countrylist` VALUES (135, 'Mauritania');
INSERT INTO `countrylist` VALUES (136, 'Mauritius');
INSERT INTO `countrylist` VALUES (137, 'Mayotte');
INSERT INTO `countrylist` VALUES (139, 'Micronesia');
INSERT INTO `countrylist` VALUES (140, 'Moldavia');
INSERT INTO `countrylist` VALUES (141, 'Monaco');
INSERT INTO `countrylist` VALUES (142, 'Mongolia');
INSERT INTO `countrylist` VALUES (143, 'Montenegro');
INSERT INTO `countrylist` VALUES (144, 'Montserrat');
INSERT INTO `countrylist` VALUES (145, 'Morocco');
INSERT INTO `countrylist` VALUES (146, 'Mozambique');
INSERT INTO `countrylist` VALUES (147, 'Myanmar');
INSERT INTO `countrylist` VALUES (148, 'Namibia');
INSERT INTO `countrylist` VALUES (149, 'Nauru');
INSERT INTO `countrylist` VALUES (150, 'Nepal');
INSERT INTO `countrylist` VALUES (151, 'Netherlands Antilles');
INSERT INTO `countrylist` VALUES (152, 'Netherlands');
INSERT INTO `countrylist` VALUES (153, 'New Caledonia (French)');
INSERT INTO `countrylist` VALUES (154, 'New Zealand');
INSERT INTO `countrylist` VALUES (155, 'Nicaragua');
INSERT INTO `countrylist` VALUES (156, 'Niger');
INSERT INTO `countrylist` VALUES (157, 'Niue');
INSERT INTO `countrylist` VALUES (158, 'Norfolk Island');
INSERT INTO `countrylist` VALUES (159, 'North Korea');
INSERT INTO `countrylist` VALUES (160, 'Northern Ireland');
INSERT INTO `countrylist` VALUES (161, 'Norway');
INSERT INTO `countrylist` VALUES (162, 'Oman');
INSERT INTO `countrylist` VALUES (163, 'Pakistan');
INSERT INTO `countrylist` VALUES (164, 'Panama');
INSERT INTO `countrylist` VALUES (165, 'Papua New Guinea');
INSERT INTO `countrylist` VALUES (166, 'Paraguay');
INSERT INTO `countrylist` VALUES (167, 'Peru');
INSERT INTO `countrylist` VALUES (168, 'Philippines');
INSERT INTO `countrylist` VALUES (169, 'Pitcairn Island');
INSERT INTO `countrylist` VALUES (170, 'Poland');
INSERT INTO `countrylist` VALUES (171, 'Polynesia (French)');
INSERT INTO `countrylist` VALUES (172, 'Portugal');
INSERT INTO `countrylist` VALUES (173, 'Qatar');
INSERT INTO `countrylist` VALUES (174, 'Reunion Island');
INSERT INTO `countrylist` VALUES (175, 'Romania');
INSERT INTO `countrylist` VALUES (176, 'Russia');
INSERT INTO `countrylist` VALUES (177, 'Rwanda');
INSERT INTO `countrylist` VALUES (178, 'S.Georgia Sandwich Isls');
INSERT INTO `countrylist` VALUES (179, 'Sao Tome, Principe');
INSERT INTO `countrylist` VALUES (180, 'San Marino');
INSERT INTO `countrylist` VALUES (181, 'Saudi Arabia');
INSERT INTO `countrylist` VALUES (182, 'Scotland');
INSERT INTO `countrylist` VALUES (183, 'Senegal');
INSERT INTO `countrylist` VALUES (184, 'Serbia');
INSERT INTO `countrylist` VALUES (185, 'Seychelles');
INSERT INTO `countrylist` VALUES (186, 'Shetland');
INSERT INTO `countrylist` VALUES (187, 'Sierra Leone');
INSERT INTO `countrylist` VALUES (188, 'Singapore');
INSERT INTO `countrylist` VALUES (189, 'Slovak Republic');
INSERT INTO `countrylist` VALUES (190, 'Slovenia');
INSERT INTO `countrylist` VALUES (191, 'Solomon Islands');
INSERT INTO `countrylist` VALUES (192, 'Somalia');
INSERT INTO `countrylist` VALUES (193, 'South Africa');
INSERT INTO `countrylist` VALUES (194, 'South Korea');
INSERT INTO `countrylist` VALUES (195, 'Spain');
INSERT INTO `countrylist` VALUES (196, 'Sri Lanka');
INSERT INTO `countrylist` VALUES (197, 'St. Helena');
INSERT INTO `countrylist` VALUES (198, 'St. Lucia');
INSERT INTO `countrylist` VALUES (199, 'St. Pierre Miquelon');
INSERT INTO `countrylist` VALUES (200, 'St. Martins');
INSERT INTO `countrylist` VALUES (201, 'St. Kitts Nevis Anguilla');
INSERT INTO `countrylist` VALUES (202, 'St. Vincent Grenadines');
INSERT INTO `countrylist` VALUES (203, 'Sudan');
INSERT INTO `countrylist` VALUES (204, 'Suriname');
INSERT INTO `countrylist` VALUES (205, 'Svalbard Jan Mayen');
INSERT INTO `countrylist` VALUES (206, 'Swaziland');
INSERT INTO `countrylist` VALUES (207, 'Sweden');
INSERT INTO `countrylist` VALUES (208, 'Switzerland');
INSERT INTO `countrylist` VALUES (209, 'Syria');
INSERT INTO `countrylist` VALUES (210, 'Tajikistan');
INSERT INTO `countrylist` VALUES (211, 'Taiwan');
INSERT INTO `countrylist` VALUES (212, 'Tahiti');
INSERT INTO `countrylist` VALUES (213, 'Tanzania');
INSERT INTO `countrylist` VALUES (214, 'Thailand');
INSERT INTO `countrylist` VALUES (215, 'Togo');
INSERT INTO `countrylist` VALUES (216, 'Tokelau');
INSERT INTO `countrylist` VALUES (217, 'Tonga');
INSERT INTO `countrylist` VALUES (218, 'Trinidad and Tobago');
INSERT INTO `countrylist` VALUES (219, 'Tunisia');
INSERT INTO `countrylist` VALUES (220, 'Turkmenistan');
INSERT INTO `countrylist` VALUES (221, 'Turks and Caicos Isls');
INSERT INTO `countrylist` VALUES (222, 'Tuvalu');
INSERT INTO `countrylist` VALUES (223, 'Uganda');
INSERT INTO `countrylist` VALUES (224, 'Ukraine');
INSERT INTO `countrylist` VALUES (225, 'United Arab Emirates');
INSERT INTO `countrylist` VALUES (226, 'Uruguay');
INSERT INTO `countrylist` VALUES (227, 'Uzbekistan');
INSERT INTO `countrylist` VALUES (228, 'Vanuatu');
INSERT INTO `countrylist` VALUES (229, 'Vatican City State');
INSERT INTO `countrylist` VALUES (230, 'Venezuela');
INSERT INTO `countrylist` VALUES (231, 'Vietnam');
INSERT INTO `countrylist` VALUES (232, 'Virgin Islands (Brit)');
INSERT INTO `countrylist` VALUES (233, 'Wales');
INSERT INTO `countrylist` VALUES (234, 'Wallis Futuna Islands');
INSERT INTO `countrylist` VALUES (235, 'Western Sahara');
INSERT INTO `countrylist` VALUES (236, 'Western Samoa');
INSERT INTO `countrylist` VALUES (237, 'Yemen');
INSERT INTO `countrylist` VALUES (238, 'Yugoslavia');
INSERT INTO `countrylist` VALUES (239, 'Zaire');
INSERT INTO `countrylist` VALUES (240, 'Zambia');
INSERT INTO `countrylist` VALUES (241, 'Zimbabwe');
/****php call: dynamic select based on $_POST****/
$ErrColor ="rgb(255,00,0)";
$SfeColor ="rgb(51,153,255)";
$SCNY = trim($_POST['x_ship_to_country']);
echo'<TD valign=top><B>Country: </B></TD><TD valign=top colspan=5><SELECT size=1 name=x_ship_to_country style="background-color:'.$SfeColor.'">';
$SHIPCountryQ = mysql_query("SELECT * FROM CountryList ORDER BY CountryID ASC")or die(mysql_error());
while ($SHIPcheckCountry=mysql_fetch_assoc($SHIPCountryQ)){
echo '<OPTION value="'.$SHIPcheckCountry['Name'].'"';
if ($SCNY == $SHIPcheckCountry['Name']){
echo ' SELECTED';
};
echo'>'.$SHIPcheckCountry['Name'].'</OPTION>';
};// end while
echo '</SELECT></TD>';
/****inital form implemntation****/
$BCNY = trim($_POST['x_country']);
echo'<TD valign=top><B>Country: </B></TD><TD valign=top colspan=5><SELECT size=1 name=x_ship_to_country style="background-color:'.$SfeColor.'">';
$SHIPCountryQ = mysql_query("SELECT * FROM CountryList ORDER BY CountryID ASC")or die(mysql_error());
while ($SHIPcheckCountry=mysql_fetch_assoc($SHIPCountryQ)){
echo '<OPTION value="'.$SHIPcheckCountry['Name'].'">'.$SHIPcheckCountry['Name'].'</OPTION>';
};// end while
echo '</SELECT></TD>';
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Content Management Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right." FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications. FREE! Go There Now!
|
|
|
|
In this tutorial, you can learn how to install and configure the IBM Rational Asset Manager Eclipse client, explore the different views in the Asset Management perspective, learn various search techniques, work with existing assets, and submit a new asset. FREE! Go There Now!
|
|
|
|
XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. FREE! Go There Now!
|
|
|
|
Rational Build Forge Express Edition is an automation framework that packages the latest enterprise-grade technologies into a reliable, flexible and robust configuration designed and priced specifically for small to midsize businesses. The new Rational Build Forge Express eKit provides you with valuable resources – including a case study, podcast, demo, and articles – to help you increase staff productivity, compress development cycles and deliver better software, fast. FREE! Go There Now!
|
|
|
|
Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic. FREE! Go There Now!
|
|
|
|
Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development. FREE! Go There Now!
|
|
|
|
The discipline of assembling and delivering software is maturing beyond standard developer-centric compile/test software builds. The end-to-end software development lifecycle is emerging as the new focus moves “Beyond the Build.” Join this on demand webcast to learn about methods for streamlining software delivery and key capabilities of the IBM Rational Build Forge framework for automating build and release management in environments of any size. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |