Hello, I'm breaking my head to try to understand and solve an issue, come on ... I'm trying to make my application as dynamic as possible, I have this form:
<form class="form-horizontal" method="post" action="atualizavalecaixa.php?id=<?php echo $id ?>">
<div class="metric-value d-inline-block">
<?php $query_f = "SELECT * FROM funcionarios WHERE nivel_id='2' AND estado='0' ORDER BY nome ASC";
$result_f = mysqli_query($conectar, $query_f);
while ($linhas_f = mysqli_fetch_assoc($result_f)){
echo
$linhas_f['nome']." <input type='texto' name='".$linhas_f['vale']."' class='col-sm-10' placeholder='Vale ".$linhas_f['nome']."'><br><br>
";}
?>
Loja<br>
<input type="texto" name="vb" class="col-sm-10" placeholder="Vale Loja"><br>
</div>
<div class="metric-label d-inline-block float-center text-danger font-weight-bold">
<button type="submit" class="btn btn-danger btn-xs">Registrar Vales</button>
</div>
</form>
In the column 'worth' of the table "civil servants" the data is saved as v (vale) + @ (initial of the name) EX: va, vb, vc ...
file "updatedate.php"
$id = $_GET['id'];
//meu problema vem agora,
$query_f = "SELECT * FROM funcionarios WHERE nivel_id='2' AND estado='0' ORDER BY nome ASC";
$result_f = mysqli_query($conectar, $query_f);
while ($linhas_f = mysqli_fetch_array($result_f)){
$vale[] = $linhas_f['vale'];
$vale = $_POST['$linhas_f[vale]'];
}
//a intensão é pegar o valor inserido no input, somar e registrar na tabela "caixa".
$query_vales = "SELECT * FROM caixa WHERE id='$id'";
$result_vales = mysqli_query($conectar, $query_vales);
while ($linhas_vales = mysqli_fetch_assoc($result_vales)){
$va= $linhas_vales["va"] + $va;
$vb= $linhas_vales["vb"] + $vb;
$vc= $linhas_vales["vc"] + $vc;
}
Does anyone know how I can do this? so when an employee registers in the system does not need to edit the code and enter manually.