I need you to give me an idea of how to solve the following problem ... It is required that when a search is made, the searched product is registered in a database and the time, and it is necessary to show the data of the search in a new form, write in the base and the problem is that I put my script At the beginning of the form where the data is displayed, then when reloading the page again it is reinserted into the database.
<form class="" action="detalleProducto.php" method="POST">
<div class="input-group">
<input type="text" placeholder="Ingrese Nombre del Producto" pattern="\w{5,12}" name="producto" class="form-control" required>
<span class="input-group-addon">
</span>
<span class="input-group-btn">
<button class="btn btn-default" type="submit" >
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</form>
is the part where I ask for the name of the product and at the beginning of detalleProduct.php I have this ....
$user = $_SESSION['usuario'];
$date = date('Y-m-d H:i:s');
$h = new Historial();
$consulta = $h->registrarConsultas(strtoupper($productoBuscado),$date, $user);
and then you have the form where the data is displayed, and therefore when reloading, the record is re-executed, I do not know how to separate it and associate it with the button of the first form.