I have a form already filled with two extra inputs only for the user to edit the information already registered and add the two new ones.
However, although%% of "saved successfully" appears, when I check with the bank, the information has not changed or added information.
My form:
<?php
require 'strcon.php';
$query = mysqli_query($strcon, "SELECT SERVICO FROM pedidos");
$cliente = filter_input(INPUT_POST, 'CLIENTE');
$servico = filter_input(INPUT_POST, 'SERVICO');
$solicitacao = filter_input(INPUT_POST, 'SOLICITACAO');
$previsao = filter_input(INPUT_POST, 'PREVISAO');
$valor = filter_input(INPUT_POST, 'VALOR');
$acerto = filter_input(INPUT_POST, 'ACERTO');
$saldo = filter_input(INPUT_POST, 'SALDO');
$id = filter_input(INPUT_POST, 'ID');
?>
<!-- formulário -->
<form method="POST" action="update-edi.php">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="form-group">
<label for="CLIENTE">Cliente:</label>
<input type="text" class="form-control" id="CLIENTE" name="CLIENTE" value="<?php echo $cliente; ?>">
</div>
<div class="form-group">
<label for="SERVICO">Serviço:</label>
<input type="text" class="form-control" id="SERVICO" name="SERVICO" value="<?php echo $servico; ?>">
</div>
<div class="form-group">
<label for="SOLICITACAO">Data de solicitação:</label>
<input type="text" class="form-control" id="SOLICITACAO" name="SOLICITACAO" value="<?php echo $solicitacao; ?>">
</div>
<div class="form-group">
<label for="PREVISAO">Data prevista:</label>
<input type="text" class="form-control" id="PREVISAO" name="PREVISAO" value="<?php echo $previsao; ?>">
</div>
<div class="form-group">
<label for="VALOR">Valor:</label>
<input type="text" class="form-control" id="VALOR" name="VALOR" value="<?php echo $valor; ?>">
</div>
<div class="form-group">
<label for="ACERTO">Acerto:</label>
<input type="text" class="form-control" id="ACERTO" name="ACERTO" value="<?php echo $acerto; ?>">
</div>
<div class="form-group">
<label for="SALDO">Saldo:</label>
<select type="text" class="form-control" id="SALDO" name="SALDO" value="<?php echo $saldo; ?>">
<option> Selecione... </option>
<option> Positivo </option>
<option> Negativo </option>
<option> Neutro </option>
</select>
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block">Salvar</button>
</div>
</div>
</div>
</form>
My update page:
<?php
$acerto = filter_input(INPUT_POST, 'ACERTO');
$saldo = filter_input(INPUT_POST, 'SALDO');
$id = filter_input(INPUT_POST, 'ID');
$strcon = mysqli_connect('localhost', 'root', '', 'sis_tam') or die('Erro ao conectar ao banco de dados');
$sql = 'UPDATE pedidos SET ACERTO = " '. $acerto . ' ", SALDO = " '. $saldo . ' " WHERE ID = " '. $id . ' " ';
mysqli_query($strcon,$sql) or die("Erro ao tentar atualizar registro. " . mysqli_error($strcon));
mysqli_close($strcon);
echo '<script type="text/javascript">
alert("Salvo com Sucesso !");
window.history.go(-1);
</script>';
var_dump($acerto, $saldo, $id);
?>
I do not understand why you are not saving, if someone understands, I thank you. :)