ciao a tutti dovrei scrivere su una tabella un nuovo record e aggiornare eventualmente uno già esistente
mi aiutate a risolvere sto impazzendo,per ora riesco solo ad eliminare il record,grazie.
mi aiutate a risolvere sto impazzendo,per ora riesco solo ad eliminare il record,grazie.
PHP:
<!-- table memo -->
<?php
if ($_SESSION['type'] == "admin") {
$result1 = mysqli_query($con, "SELECT * FROM `memo` WHERE 1") or die(mysqli_error($con));
while($row1 = mysqli_fetch_assoc($result1)){
echo' <form action="gestuser.php" method="post" id="f'.$row["id"].'"></form>';
}
echo'
<div class="card mb-3">
<div class="card-header font-weight-bold">
<i class=""></i>Promemoria Utenti</div>
<div class="card-body">
<div class="table-responsive">
<form action="gestuser.php" method="post" id="tf"></form>
<table class="table table-bordered table-hover" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Id Utente</th>
<th>Nome Telegram</th>
<th>Utente</th>
<th>Password</th>
<th>Data</th>
<th>Crd</th>
<th>Servizio</th>
<th>Opzioni</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th><input placeholder="telegram" name="telegram" form="tf"> </input></th>
<th><input placeholder="username" name="username" form="tf"> </input></th>
<th><input placeholder="password" name="password" form="tf"> </input></th>
<th><input placeholder="data" name="data" form="tf"> </input></th>
<th><input placeholder="crd" name="crd" form="tf"> </input></th>
<th><input placeholder="servizio" name="servizio" form="tf"> </input></th>
<th><button type="submit" class="btn btn-default fa fa-arrow-right" form="tf"> Crea Memo</button></th>
</tr>
</tfoot>
<tbody>
';
$result = mysqli_query($con, "SELECT * FROM `memo` WHERE 1") or die(mysqli_error($con));
while($row = mysqli_fetch_assoc($result)) {
echo'<td>'.$row["id"].'</td>';
echo'<td>'.$row["telegram"].'</td>';
echo'<td>'.$row["utente"].'</td>';
echo'<td>'.$row["password"].'</td>';
echo'<td>'.$row["data"].'</td>';
echo'<td>'.$row["crd"].'</td>';
echo'<td>'.$row["servizio"].'</td>';
echo'
<td><a href="#" class="fa fa-trash" style="font-size:24px;color:grey" data-toggle="modal" data-target="#f'.$row["id"].'"></a>
<div class="modal fade" id="f'.$row["id"].'" tabindex="-1" role="dialog" aria-labelledby="f'.$row["id"].'" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="f'.$row["id"].'">Rimozione</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">Sei sicuro di voler rimuovere '.$row["utente"].'?</div>
<div class="modal-footer">
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="gestfile1.php?remove='.$row["id"].'">Rimuovi</a>
</div>
</div>
</div>
</div>
';
echo'
<a href="#" class="fa fa-refresh" style="font-size:24px" data-toggle="modal" data-target="#m'.$row["id"].'"></a>
<div class="modal fade" id="m'.$row["id"].'" tabindex="-1" role="dialog" aria-labelledby="m'.$row["id"].'" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="m'.$row["id"].'">Aggiornamento</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">Sei sicuro di voler Aggiornare '.$row["utente"].'?</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary" form="f'.$row["id"].'">Aggiorna</button>
</div>
</div>
</div>
</div>
</td>
';
echo'</tr>';
}
echo'
</tbody>
</table>
</div>
</div>
</div>
';
}
?>