Magento- Create a Drop-Down list of Countries

Country list is very important in magento form, every custom module form normally need country dropdown list.In this article i will let you know how to get Countries list and display dropdown on front end and admin form. We first needed to access a collection of countries in Magento,there are some simple functions that we can use to access country names and codes in Magento.

Also Checkout other tutorial of Magento,

Simple Steps to Create Drop down list in Magento

Step 1: We will get an Array of Country Names/Codes in Magento.


The above code will print out an array containing every country code with country name stored in Magento.

Step 2: We pass above arrays to HTML control to display Drop Downs list:

How to create a Country Drop Down in the Frontend of Magento

We need to Add the following code to any template file in the frontend of Magento and you will get a drop down box using the country name as the label and the country code as the value.

How to create a Country Drop Down in the Magento Admin
When you are creating forms in the Magento Admin area, you can just create control on form.php.