form_dropdown() in codeigniter

Hi, I am a complete novice to codeigniter and  have no idea how to handle this

I have a query in my controller:

  	// dropdown list  
		  $this->data['main_level'] = $this->menu->main_level();

Open in new window

  in my view I am definining a form:
 <?php echo form_open(); ?>

<table class="table">
			<td><?php echo form_dropdown('parent_id', $main_level, ' '); ?> </td>

<?php echo form_close();?>

Open in new window

now, upon selection I want to run another query and display the result under the dropdown ?. How to do it ?
Also can I have blank in the third parameter for the dropdown indicating that upon loading
nothing was selected ?
  $this->data['main_level'] = $this->menu_model->main_level();

Open in new window

Who is Participating?
mcnuteConnect With a Mentor Commented:
Ajax is your way to do it. Jquery implement very good ajax methods.

In your ajax request you specify the controller which sends back the list options based on a parameter you gaven in the ajax call like so:

									url: 'your/controller',
									data: 'option=1',
									success: function(data) {
										//insert the results in the sepcified select list.

Open in new window

Loganathan NatarajanLAMP DeveloperCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.