Bonjour,

J'aimerai mettre à jour le champ envoye de ma table poster. J'ai un formulaire que les utilisateurs peuvent mettre à jour au niveau d'un champ envoyé ou non pour un document à expédier. Lorsqu'ils ouvrent le formulaire, ils peuvent cliquer ou non la case envoyé ?.
Je n'arrive pas à récupérer ce qu'il se passe dans cette case pour chaque enregistrement, je m'embrouille
Merci d'avance pour votre gentillesse, grace à vous, j'arrive à avancer et surtout comprendre

Voici mon code :

Code php : 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
 
<?php
include 'connection.php';
 
$id=$_POST['id'];
 
if(isset($_POST["submit"])) {
 
    $sql = "UPDATE poster SET envoye = '$envoye' WHERE id = '$id'";
    $resultat = mysql_query($sql,$conn)  or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
 
	if (!$resultat){
	$msg="Erreur !";
	echo "<SCRIPT LANGUAGE=\"JavaScript\">document.location.href=\"gerer.php?msg=".$msg."\"</SCRIPT>";
	}	
	else {	
	$msg="Modification ok!";
	echo "<SCRIPT LANGUAGE=\"JavaScript\">document.location.href=\"gerer.php?msg=".$msg."\"</SCRIPT>";
	}
}
 
 
$sql = "SELECT *
	  FROM poster
	  order by id asc";
 
$resultat = mysql_query($sql,$conn)  or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
while ($rang= mysql_fetch_array ($resultat))
{
 
$id_poster = $rang['id'];
} 
 
 
?>
 
 
<form method="post" action="poster.php">
	<input name="id" value="<?php  echo $id ;?>">
 
   <table class="table2bis">
                <thead>
 
                    <tr>
                        <th width="37">id</th>
                        <th width="511" scope="col" abbr="Business">Coordonnées client </th>
                        <th width="200" scope="col" abbr="Deluxe" ><span class="Style1">Le poster a-t-il été envoyé ? </span></th>
                        <th width="182" scope="col" abbr="Deluxe"><span class="Style2">Supprimer</span></th>
                    </tr>
                </thead>
 
                <tbody>
                    <tr>
                        <th height="108" scope="row" style="border-bottom:1px solid #333;"><?php echo $rang['id'] ?>&nbsp;</th>
                        <td style="border-bottom:1px solid #333;">&nbsp;</td>
                        <th scope="row" style="border-bottom:1px solid #333;">
 
							<table width="100%" border="0">
                                  <tr>
                                    <td>																								
									  <div align="center">
 
										<!--<input type="checkbox" name="envoye[]" value="<?php //echo $envoye ?>">-->
										<input type="checkbox" name="envoye" <?php if($rang["envoye"] == 1) {echo 'checked';} ?>/>
 
							          </div></td>
 
                                  </tr>
                                </table>
 
					        </td>
                       </tr>
 
<?php
 
       }
	   mysql_close($conn); 
  ?>
               <tfoot>
 
			   <tr>
            <td class="Style5" ></td>
            <td class="Style5" ></td>
            <td></td>
            <td><div align="center">
			  <p>
 
			  </p>
 
				  <input class="button blue small" title="Envoyer" name="submit" type="submit" id="submit" tabindex="13" value="SUBMIT" /> 
            </div></td>
            </tr>
     </tfoot>
 
			    </tbody>
		  </table>
  </form>