Colleagues.
I have a select from which the data comes from a database. See:
public function verSelect($tabela,$idTB,$nomeTB,$nomeSelect){
$query = "SELECT * FROM ".$tabela;
// echo $query;
$sqlSelect = mysqli_query($this->conexao,$query);
$select = "<select name='".$nomeSelect."' class='form-control' id='selecionar'>";
$select .= "<option value='selecione'>Selecione</option>";
while($jmSelect = mysqli_fetch_object($sqlSelect)){
$select .= "<option value='".$jmSelect->$idTB."'>".$jmSelect->$nomeTB."</option>";
}
$select .= "</select>";
return $select;
}
Cool, cool, so far so good. However I need to make when selecting an item from this select, a div appears with the contents of another table that is already related. For example: Let's suppose that I choose Fernando Pessoa in this select, would automatically appear the div with the word poet from another table.
Remember that the table already exists and is populated with the information, I only need the mechanics in Javascript or jquery on how to do this.