I would like to know if it is possible to run a real-time calculation with jquery inside a php foreach and how? This is my code:
<?php
$Read = new Read;
$Read->ExeRead("c100web", "WHERE codclient = :client", "client={$Clie}");
if (!$Read->getResult()):
VARErro("Não á registros na lista, cadastre os produtos!", INFOR);
else:
foreach ($Read->getResult() as $Pedidos):
extract($Pedidos);
$Style = "";
$ReadProd = new Read;
$ReadProd->ExeRead("c007prod", "WHERE codigo = :cod", "cod={$codpro}");
if ($ReadProd->getResult()):
$Nome = $ReadProd->getResult()[0]['descricao'];
$PrecoUni = $ReadProd->getResult()[0]['preco_venda'];
endif;
?>
<tr>
<td><?= $Nome; ?></td>
<td><input disabled="" type="text" name="vlruni" id="vlruni" value="<?= $PrecoUni; ?>"/></td>
<td><input type="number" name="qnt[]" id="qnt" value="<?= $qntpro; ?>"/></td>
<td><input disabled="" type="text" name="vlrtl" id="vlrtl"/></td>
</tr>
<tr><td colspan="4" style="padding: 4px; background-color: #ccc;"></td></tr>
<?php
endforeach;
?>
<tr>
<td colspan="3">Valor total do pedido:</td>
<td><input disabled="" type="text" name="vlrlist" id="vlrlist"/></td>
</tr>
<?php
endif;
?>
It's basically like this: vlruni * qnt = vlrtl and vlrtl + vlrtl + vlrtl .... = vlrlist, is it possible? ... thanks!
HTML:
<tr>
<td>ACUCAR MASCAVO FAVINHO 500G</td>
<td><input disabled="" type="text" name="vlruni" id="vlruni" value="4.6"/></td>
<td><input type="number" name="qnt[]" id="qnt" value="12"/></td>
<td><input disabled="" type="text" name="vlrtl" id="vlrtl"/></td>
</tr>
<tr><td colspan="4" style="padding: 4px; background-color: #ccc;"></td></tr>
<tr>
<td>ACUCAR MASCAVO FAVINHO 1K</td>
<td><input disabled="" type="text" name="vlruni" id="vlruni" value="7.7"/></td>
<td><input type="number" name="qnt[]" id="qnt" value="10"/></td>
<td><input disabled="" type="text" name="vlrtl" id="vlrtl"/></td>
</tr>
<tr><td colspan="4" style="padding: 4px; background-color: #ccc;"></td></tr>
<tr>
<td>AMENDOIM AMENDUPÃ C/ CASCA 280G</td>
<td><input disabled="" type="text" name="vlruni" id="vlruni" value="2.7"/></td>
<td><input type="number" name="qnt[]" id="qnt" value="5"/></td>
<td><input disabled="" type="text" name="vlrtl" id="vlrtl"/></td>
</tr>
<tr><td colspan="4" style="padding: 4px; background-color: #ccc;"></td></tr>