Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point a way to form a view's combo based on Codeigniter's results?

Hi Experts

Could you point a way to form a view's combo based on Codeigniter's results?

Accordingly to:

Controller's code:
public function index() {

	// SELECT/DROPDOWN - Seguradora
	$fk_seguradora = $this->cliente_corporativo_model->new_get(array('query' => 'select * from system_seguradora'));
	$dropdown[0] = 'Selecione ...';
	foreach ($fk_seguradora as $key => $value)
		$dropdown[$value->id_seguradora] = $value->nome_seguradora;

	$this->data['fk_seguradora'] = form_dropdown('fk_seguradora', $dropdown, '', 'id="id_seguradora"');
	unset($dropdown);
	
	...

Open in new window



View's code:
The values are actually "hard coded"
  <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>
			<span class="select">
				<select id="fk_seguradora" name="fk_seguradora">
					<option value="" selected="selected">...Cliente Corporativo...</option>
					<option value="1">Ace</option>
					<option value="2">Zurich</option>
					<option value="3">Banco Safra</option>
					<option value="4">SANTANDER</option>
					....
				</select>
			</span>
		</div>
	</div>
</div>

Open in new window


I tryed to do this way:
<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>
			<span class="select">
				<select id="fk_seguradora" name="fk_seguradora">
				
                                  // A for-each at this point makes sense?? - I guess there is a better option.
				   <option value="<?php $id_seguradora?>"><?$fk_seguradora?></option>
 
						
				</select>
			</span>
			</label>
		</div>
	</div>
</div>

Open in new window


Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eduardo Fuerte

ASKER

Hi @Chris

You are perfectly right.

I'm the meanwhile I did this way:

 <div class="row">
                <div class="col-xs-12 mb15">                           
                    <!--label for="fk_seguradora" class="field-label text-muted mb10">Cliente Corporativo</label-->
                    <!--span class="input-group-addon "-->
                            <i class="fa fa-search c-gray"></i>
                    <!--/span-->
                    <label for="fk_seguradora" class="validar field select">
                        <?php echo $fk_seguradora; ?>
                        <i class="arrow double"></i>
                    </label>
                </div>
            </div>

Open in new window


Just a problem in correctly positionate the icon.
User generated image
That's more likely to be a CSS issues rather than a CodeIgniter one.
I'm going to ask another question on this particular subject, since it has derivated from the initial question.

Thanks for help!