0
In my system there is a page with a form that registers an order and another page with a table that shows all registered order records.
Each row of the table has a request and an edit button that opens a form equal to the one used in the application registration that should be filled with the registered information.
This is the edit button:
// Adicionando botão de exclusão
$table .= '<td><form action="FormEdicao.php" method="post">';
$table .= '<input type="hidden" name="ID" value="'.$r['ID'].'">';
$table .= '<input type="hidden" name="CLIENTE" value="'.$r['CLIENTE'].'">';
$table .= '<input type="hidden" name="SERVICO" value="'.$r['SERVICO'].'">';
$table .= '<input type="hidden" name="SOLICITACAO" value="'.$r['SOLICITACAO'].'">';
$table .= '<input type="hidden" name="PREVISAO" value="'.$r['PREVISAO'].'">';
$table .= '<input type="hidden" name="VALOR" value="'.$r['VALOR'].'">';
$table .= '<button class="btn btn-primary"><i class="glyphicon glyphicon-pencil"> Editar </i></button>'; //aqui está o seu botão
$table .= '</form></td>';
}
This is the editing 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, 'PREVISAO');
$valor = filter_input(INPUT_POST, 'VALOR');
$id = filter_input(INPUT_POST, 'ID');
?>
<!-- formulário de edição -->
<form method="POST" action="update-ped.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>
<button type="submit" class="btn btn-primary btn-lg btn-block">Salvar</button>
</div>
</div>
</div>
</form>
But for some reason these fields that should be filled are not, follow images to facilitate:
As this your edit button?
– Roberto de Campos
My edit button is a normal href that redirects to the edit page.
– Mariana Bayonetta
I’ll put my edit button on the question.
– Mariana Bayonetta
Dude, the problem was the edit button, the Naames were wrong, you were right.
– Mariana Bayonetta