you bring the information that you are going to put into the database select
example here the logical model
public function listar(){
$datos = array();
$consulta="SELECT * FROM tblProductos p inner join tblSubcategorias s on p.idSubcategoria=s.idSubcategoria inner join tblCategorias c on c.idCategoria=s.idCategoria";
$resultado = $this->conexion->query($consulta);
while ($filaTmp = $resultado->fetch_assoc()) {
$datos [] = $filaTmp;
}
if($resultado){
return $datos;
}
elseif (!$this->conexion->query($consulta)) {
echo $this->conexion->errno . " : " . $this->conexion->error . "\n";
}
}
driver send the data to the view
require_once("../../model/productos.php");
$varProductos= new productos();
$productos = $varProductos->listar();
you do the route in the option
<div class="form-group col-md-12">
<label class="control-label">Productos</label>
<select class="form-control input-sm selectpicker" name="producto[]" multiple data-error="Es un campo obligatorio" data-live-search="true" required="required">
<?php
foreach ($productos $producto){
echo '<option value="'.$producto['idProducto'].'">'.$producto['producto'].'</option>';
?>
<?php
}
?>
</select>
<div class="help-block with-errors"> </div>
</div>