Could you point how to correctly present an already obtained array from CodeIgniter's model in the View?

Hi Experts


Could you point how to correctly present an array already obtained from CodeIgniter's model in the View?

Controller's code:
$this->data['fk_seguradora_f'] = $this->seguradora_model->get_seguradoras();

Open in new window


Model's Code:
function get_seguradoras( ) 
{ 
	$fk_seguradora_f = array();

	$query=$this->db->query("SELECT id_seguradora, nome_seguradora FROM system_seguradora");
	$fk_seguradora_f = $query->result_array();

	return $fk_seguradora_f;
}

Open in new window


View's code
<div class="row">
	<div class="col-xs-12 mb15">
		<div class="input-group">
			<span class="input-group-addon ">
				<i class="fa fa-search c-gray"></i>
			</span>
			<!--EF Jan/2017 - Campo de filtro dinamicamente formado --->
			 <span class="select">
				 <select id="fk_seguradora" name="fk_seguradora">
						<?php
						
                                               var_dump('testeyyy'); // just to locate the code easily.
						var_dump($fk_seguradora_f);
						die;
						
						
						foreach($fk_seguradora_f as $each)
						{
						?>
							<option value="<?=$each['id_seguradora']?>"><? echo $each['nome_seguradora']?></option>
						<?php
						}
						?>
				</select>
			  </span>
		</div>
	</div>
</div>

Open in new window


Debbuging, the array is correctly obtained in the view:
img001
The combo is functional but the names (nome_seguradora) doesn't appears.

img002Could you point a workaround on this?

Thanks in advance!
Eduardo FuerteDeveloper and AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mukesh YadavFull Stack DeveloperCommented:
Share the HTNL you are getting in the browser for the select element.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Hi

After checking the HTML generated in the browser to attend your request I saw that:

  <option value="<?=$each['id_seguradora']?>"> <?=$each['nome_seguradora']?></option>

Open in new window


Must to be corrected to:
<option value="<?=$each['id_seguradora']?>"><? echo $each['nome_seguradora']?></option>

Open in new window


So everything is fine now...
Eduardo FuerteDeveloper and AnalystAuthor Commented:
I inverted:

Correct

<option value="<?=$each['id_seguradora']?>"> <?=$each['nome_seguradora']?></option>

Open in new window



Incorrect:
<option value="<?=$each['id_seguradora']?>"><? echo $each['nome_seguradora']?></option>

Open in new window

Eduardo FuerteDeveloper and AnalystAuthor Commented:
Thanks for help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.