How to get the names of a field to an option value="" / option

0

I've been around all day trying to do the following and I do not get it.
I would like to pass the datos of campo (NOMBRE) of the TABLE ARTISTS to the value attribute <option value> of a form.

This is the driver :

public function artistas(){
	
		$this->load->model("m_Artistas", "artistas");
        $artistas =$this->artistas->listar_artistas();
     
		$html = $this->load->view("artistas/vista_artistas", array("bucle_artistas"=>$artistas), true); 
		$this->load->view('landingpage', array("contenido"=>$html)  ); 
	}

This is the model :

function listar_artistas(){
			$tmp = $this->db
			->select("id, nombre, descripcion")
			->order_by("nombre", "asc")  
			->get("artistas");
			
		return $tmp->result_array();
		}

This is the view :

<form action="" method="POST">
   <select id="id_artista" name="artista" class="form-control" >
    <option value="0"selected> Ninguno</option>
    <option value="1">Shakira</option>
    <option value="2">Bruce Springsteen</option>
   </select>
    
asked by David 02.10.2018 в 23:48
source

0 answers