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! |
As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper. FREE! Go There Now!
|
|
|
|
WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial version of WebSphere Extended Deployment Compute Grid, which lets you schedule, execute, and monitor batch jobs. Because online transaction processing and batch jobs execute simultaneously on the same server resources, you can avoid costly duplication of resources. Compute Grid supports job types of Java transactional batch, compute-intensive and a new type called "native execution", which enables non-Java workloads to run on distributed end points. FREE! Go There Now!
|
|
|
|
IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects. FREE! Go There Now!
|
|
|
|
Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered! FREE! Go There Now!
|
|
|
|
Regression testing -- in which code is thoroughly tested to ensure that changes have not produced unexpected results -- is an important part of any development process. But many testing environments neglect the terminal-based applications that still form the backbone of many industries. In this tutorial, you'll learn how the Rational Functional Tester Extension for Terminal-Based Applications works with other Rational Functional Tester to help test terminal-based applications quickly and easily. 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!
|
|
|
|
Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |