0
I am enthusiastic, I do some simple things for a hobby, and in this case I’ve caught up with a part that I imagine for you must be very simple! I have a task system, in the form I have a service select, which displays the service name, and I need the value of that service to be applied in an input. By servico_id I arrive in the userName in select, in the input I want to display the useValue.
//SELECT DE SERVIÇO
<div class="col-md-4">
<label for="servicos_id" class="control-label">Serviço</label>
<div class="form-group">
<select name="servicos_id" id="servicos_id" class="form-control select2" style="width: 100%;">
<option value="">Selecionar serviço</option>
<?php
foreach($all_servicos as $servico)
{
$selected = ($servico['idServicos'] == $this->input->post('servicos_id')) ? ' selected="selected"' : "";
echo '<option value="'.$servico['idServicos'].'" '.$selected.'>'.$servico['nomeServico'].'</option>';
}
?>
</select>
<span class="text-danger"><?php echo form_error('servicos_id');?></span>
</div>
</div>
// INPUT VALOR DO SERVIÇO
<div class="col-md-2">
<label for="valorTarefa" class="control-label">Valor</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-dollar"></i></span>
<input type="text" name="valorTarefa" value="<?php echo $this->input->post('valorTarefa'); ?>" class="form-control" id="valorTarefa" />
<span class="text-danger"><?php echo form_error('valorTarefa');?></span>
</div>
</div>
Could someone help me? Thank you!!
– Luciano Marangoni