I have two input fields, one being generated according to the value of the step I enter in this input. Follow Function below:
public function autoCompleteCilindro($q){
$this->db->select('*');
$this->db->limit(5);
$this->db->like('passo', $q);
$query = $this->db->get('cilindros');
if($query->num_rows() > 0){
foreach ($query->result_array() as $row){
$row_set[] = array('label'=>'Impressora: '.$row['impressora'].' | Cilindro: '.$row['engrenagens'].' | Passo: '.$row['passo'].' | Quantidade: '.$row['quantidade'],'quantidade'=>$row['quantidade'],'id'=>$row['idCilindro'],'engrenagens'=>$row['engrenagens']);
}
echo json_encode($row_set);
}
}
In this way, I am presented in this field, the values of the BD "cylinders", all in this field.
What I need is that in the next input field "height", get the value of the "step" that was chosen and be divided by the input field "quantity", which will be mentioned later.
Example:
If I type "200", it appears to me:
Impressora: Módulo C/P 1/8 | Cilindro: 63Z | Passo: 200.03 | Quantidade: 18 Impressora: Módulo 1 | Cilindro: 60Z | Passo: 200.58 | Quantidade: 12
If I choose the line containing step 200.03, the value of the "step" field divided by the "quantity" field is automatically calculated in the "height" field.