0
I have an order form where the name of the customer is chosen and I would like from this selection to be filled in the discount field, this value is in the same table where the customer registration is.
How can I make the discount field be filled from the customer’s choice?
my select is like this:
$qr2=mysqli_query($conexao,"SELECT * FROM `clientes` order by `nome`");
if (mysqli_num_rows($qr2)==0)
echo "Adicione ao menos um Cliente";
the field in the form where the customer is chosen is thus:
<strong><b><font size="3"> <font color="#000000">Cliente :</strong>
<select name="clienteAt"> <option value="">Selecione o Cliente</option>
<?php
while ($row=mysqli_fetch_array($qr2)){
?>
<option value="<?php echo $row['id']?>"><?php echo $row['nome']?></option>
<?php }?>
</select>
and the discount field is like this:
<td>
<input name="desconto[]" type="text" required name="desconto"
maxlength="30" size="11" onblur="Calc(this)"
style="text-align:center"
class="desconto" />
</td>
Use javascript.
– Alex
You can store client discount data in a js array and use logic to set the value in the input
– Costamilam