I apologize for my bad English and I hope I can better explain my problem and receive your support. Thank you
I created a small function in php where I can search the database for a “card” number, once the card number is found, “name, surname, customer_id, card number” are returned to me.
once I see this information inside I have to save in the database “points, expense, customer_id” points and expense “are saved successfully while” customer_id "is not saved what am I wrong?
this is my code
<form action="" method="post">
<input type="text" name="tessera" placeholder="Inserisci Numero Tessera"/>
<input type="submit" name="search" value="Cerca"/>
</form>
<?php
$connection = mysqli_connect("localhost","user","password");
$db = mysqli_select_db($connection,'database');
if(isset($_POST['search']))
{
$id = $_POST['tessera'];
$query = "SELECT tessera,nome,cognome,id_cliente FROM cliente where tessera='$id'";
$query_run = mysqli_query($connection,$query);
while($row = mysqli_fetch_array($query_run))
{?>
<form action="" method="post">
<input type="text" name="tessera" disabled="disabled" value="<?php echo $row['tessera'] ?>"/><br>
<input type="text" name="nome" disabled="disabled" value="<?php echo $row['nome'] ?>"/><br>
<input type="text" name="cognome" disabled="disabled" value="<?php echo $row['cognome'] ?>"/><br>
<input type="text" name="id_cliente" disabled="disabled" value="<?php echo $row['id_cliente'] ?>"/>
<input class="form-control" type="text" id='punti' name="punti" />
<input class="form-control" type="text" id='spesa' name="spesa" />
<input class="form-control" type="date" id='data_punti' value="<?php echo date('Y-m-d'); ?>" name="data_punti" />
<input type="submit" name="update" value="aggiungi">
</form>
<?php
}}?>
<?php
$connection = mysqli_connect("localhost","user","password");
$db = mysqli_select_db($connection,'database');
if(isset($_POST['update']))
{
$query = "INSERT INTO punti (punti, spesa, data_punti, id_cliente)
VALUES('".$_POST["punti"]."','".$_POST["spesa"]."','".$_POST["data_punti"]."', '".$_GET["id_cliente"]."')";
$query_run = mysqli_query($connection,$query);
if($query_run)
{echo '<script> alert("aggiunti")</script>';
}else
{echo '<script> alert("errore") </script>';
}}?>
thanks