Friday, March 16, 2018

Suppose you are building a Registration form in which users want to select a city to lives in. For that you need to populate respected state that person lives in, otherwise the city field will be extremely long (and there is more of a chance for user mistake and mystification). To solve this problem we need to create dynamic needy dropdowns. In order to accomplish this using Code Igniter, this is what I did:

Html view form dropdownpopulate.php

Now I will create database table for state and cities dropdown populate.

This code was put into a code igniter view file called “dropdownpopulate.php”.
Now we add form open and closing form tags, and looks to a controller.
Here in the controller we will create a function to load the view file.
To load the states dropdown, we need to create model function get_state_info() to load the states information to controller file named as “ektree.php”.

Here I used JavaScript on select function to load city dropdown
In script I posted the state value to controller and print the out to html view file.

Now I will create model functions to get the state and cities details.

Thanks for reading this article.

Tags: , ,
I am Saritha Reddy, a Remote codeigniter,Angularjs Developer. I have 4+ years of strong experience in designing, implementing, Programming and delivering advanced XAMPP ( Apache, MySQL and PHP) Web applications development. I am an Indian national and based Andhra Pradesh,Hyderabad. In addition to providing custom programming and design, I also have extensive experience with Open Source technologies to keep costs down and get websites running with as little fuss and wait as possible.


Leave a Comment

Subscribe Now

Enter your email address:

Delivered by FeedBurner


panda lamp