Bonjour, j'ai un problème avec ma requête insert car je génère un tableau dynamique et je sais pas comment enregistrer les données de ma base pour chaque ligne du tableau.
tableau:
requete:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 </table> <?php $id_plan = $_POST['SIG_PLAN']; $orders = $DB->query("SELECT id_wms FROM tbl_orders WHERE id_plan = '$id_plan'"); ?> <?php foreach ($orders as $order): ?> <table border="0" cellpadding="4" cellspacing="0" class="ligne_lot"> <td><input value="<?= $order->id_wms ?>" class="" type="text" name="SIG_PALCHARG[]" id="SIG_ORDER" style="border: hidden; width: 50px" readonly="readonly"/></td> <td><label><input value="" class="" type="text" name="SIG_PALCHARG[]" id="SIG_PALCHARG" style="border: hidden; width: 50px"/></label></td> <td><label><input value="" class="" type="text" name="SIG_PALCHEP[]" id="SIG_PALCHEP" style="border: hidden; width: 50px"/></label></td> <td><label><input value="" class="" type="text" name="SIG_PALBOIS[]" id="SIG_PALBOIS" style="border: hidden; width: 50px"/></label></td> </table>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <?php $SIG_PLAN = $_POST['SIG_PLAN']; /* VALIDATE HOW YOU NEED TO VALIDATE */ if($_POST) { /* VALUES */ $SIG_ORDER = $_POST['SIG_PALCHARG'][]; $SIG_PALCHARG = $_POST['SIG_PALCHARG'][]; $SIG_PALCHEP = $_POST['SIG_PALCHEP'][]; $SIG_PALBOIS = $_POST['SIG_PALBOIS'][]; $req = $DB->insert_update_delete("INSERT INTO log_sigboldep (SIG_PLAN, SIG_ORDER, SIG_PALCHARG, SIG_PALCHEP, SIG_PALBOIS) VALUES('$SIG_PLAN', '$SIG_ORDER', '$SIG_PALCHARG', '$SIG_PALCHEP', '$SIG_PALBOIS')"); } else { header('HTTP/1.1 500 Looks like mysql error, could not insert record!'); exit(); } ?>
Partager