Bonjour,

J'aurais besoin d'aide pour connaître la méthode qui permet dans un formulaire de pouvoir cocher plusieurs checkbox et de faire un update de l'ensemble des valeurs associées à celles-ci.

Voilà pour l'instant où j'en suis :

mon formulaire :

Code : HTML

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
23
24
25
26
<form method="post" name="form1" action="tstocktech.php">
<?php do { ?>
<input name="check_stocko" type="checkbox" value="<?php echo $row_rsstocko2['id_stocko']; ?>" />
<input type="text" name="numbl_stocko" value="<?php echo $row_rsstocko2['numbl_stocko']; ?>" size="5" readonly="readonly">
<input size="8" type="texte" name="dateliv_stocko" value="<?php list($year, $month, $day) = explode("-", $row_rsstocko2['dateliv_stocko']); echo $row_rsstocko2['dateliv_stocko'] = "$day-$month-$year";?>" readonly="readonly"/>
<input type="text" name="denom_stocko" value="<?php echo $row_rsstocko2['denom_stocko']; ?>" size="15" readonly="readonly">
<input type="text" name="numlot_stocko" value="<?php echo $row_rsstocko2['numlot_stocko']; ?>" size="15" readonly="readonly">
<input type="text" name="numbout_stocko" value="<?php echo $row_rsstocko2['numbout_stocko'];?>" size="15" readonly="readonly">
<?php } while ($row_rsstocko2 = mysql_fetch_assoc($rsstocko2)); ?>
<select name="listetech"><?php
do {
?><option value="<?php echo $row_ttechnicien['id_use']?>">
          <?php echo $row_ttechnicien['nom_use']?>
          </option>
          <?php
} while ($row_ttechnicien = mysql_fetch_assoc($ttechnicien));
  $rows = mysql_num_rows($ttechnicien);
  if($rows > 0) {
   mysql_data_seek($ttechnicien, 0);
   $row_ttechnicien = mysql_fetch_assoc($ttechnicien);
  }
?>
          </select>
 
<input type="submit" value="Valider">
<input type="hidden" name="id_stocko" value=""> </form>
et le script d'Update associé :

Code : PHP

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
$check=$_POST['check_stocko'];
  $liste=$_POST['listetech'];
  $datesortie=$_POST['datesortie_stocko'];
  $etat='2';
  $dispo='1';
 
$req1 = "UPDATE tstockoxy SET etat_stocko='$etat', dispo_stocko='$dispo', datesortie_stocko='$datesortie', numtec_stocko='$liste' WHERE id_stocko='$check'";
  mysql_query($req1) or die(mysql_error()) ;
Une petite idée ? MERCI