Hi! I have two dropdownlist in one view but i don't know if i can load the view passing the two arrays like this:
$this->load->view('primerPaso',$data,$data2);
To be more specific i'm doing everything like this:
Model
/*
* Método encargado de consultar las ciudades
* donde existen agencias.
*/
function ConsultarCiudadesAgencias()
{
$this->db->select('LISValor');
$this->db->from('410LIS');
$this->db->where('LISNombre','ESTLista3');
$query = $this->db->get();
$result = array();
if($query->num_rows() > 0)
{
foreach ($query->result_array() as $row)
{
$result[$row['LISValor']] = $row['LISValor'];
}
return $result;
}
}
/*
* Método encargado de consultar los diferentes
* tipos de vehiculos que existen para su alquiler.
*/
function ConsultarTiposVehiculos()
{
$this->db->select('LISValor');
$this->db->from('410LIS');
$this->db->where('LISNombre','SUBLista3');
$query = $this->db->get();
$result = array();
if($query->num_rows() > 0)
{
foreach ($query->result_array() as $row)
{
$result[$row['LISValor']] = $row['LISValor'];
}
return $result;
}
}
Controller:
function index()
{
$this->load->model('PrimerPasoModel');
$data['ciudades'] = $this->PrimerPasoModel->ConsultarCiudadesAgencias();
$data2['vehiculos'] = $this->PrimerPasoModel->ConsultarTiposVehiculos();
$this->load->view('primerPaso',$data,$data2);
}
and in the view i have this (not going to paste all the html):
<tr>
<td>Ciudad de Alquiler:</td>
<td><?php echo form_dropdown('CiudadAlquiler',$ciudades); ?></td>
</tr>
<tr>
<td colspan="2">
<?php echo form_dropdown('TipoVehiculo',$vehiculos);?>
</td>
</tr>
whit this code i get this error:
Severity: Notice
Message: Undefined variable: vehiculos
Filename: views/primerPaso.php
Line Number: 76
Where "primerPaso.php" is the name of mi view.
Thanks for your time and help.