lundi 16 septembre 2019

PHP update SQL from multiple HTML checkbox

I am trying to update/del from database from SQL / whileloop with checkboxes checked.

$sqlListSections = "SELECT * FROM avdelningar WHERE user = {$_SESSION['id']}";
$queryListSections = mysqli_query($mysqli, $sqlListSections);

while($rowListSections = mysqli_fetch_array($queryListSections)) 
{

echo "  
$rowListSections['id'].
$rowListSections['namn'].
$rowListSections['platser'].
$rowListSections['prio'].
"<input type=checkbox name=del{$rowListSections['id']} value={$rowListSections['id']}>
</form>";

}

Should I put another identical loop above and run the if(isset($_POST)) and update so I get the updated version when I echo the data for the user? Because I cant do it in the same loop, then it wont show the new SQL data?




Aucun commentaire:

Enregistrer un commentaire