bonjour j'ai un problème . je vais afficher des valeurs a partir de ma base de données oracle sous forme d'un tableau puis devant chaque ligne j'ai un ckeckbox et je veux insérer les lignes cochées dans une autre table de la base de données et le problème au niveau de l'insertion lorsque je clique sur le bouton effectuer que l'insertion de la dernière ligne s'effectue que ce soit elle est cochée ou pas .
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
<div>
<form action="ajout_affichage.php" method="post" name="formulaire">
<table width="300" align="center" >
<tr>
<td align="left" valign="top"></td>
<td width="150" align="left" valign="top" nowrap="nowrap" bgcolor="#FFFFFF" required ><strong>Nombre de l'affichage publicitaire </strong></td>
<td width="150" align="left" valign="top"><input type="number" name="nom" style="height:20px;" size="30" required onBlur="verifNom(this);" value="<?php if (isset($_POST['id'])) echo htmlentities($_POST['id']); ?>" /></td>
</tr>
 
<table align="center" width="850">
<tr>
<th width="122">cochez</th>
<th width="122">Nom de la division</th>
<th width="120" >X</th>
<th width="52" >Y</th>
<th width="88" >Longueur</th>
<th width="81" >Largeur</th>
</tr>
<?php
$conn = oci_connect('biat', 'biat','localhost/XE');
$sql="select * from DIVISION ";
$statement = oci_parse($conn, $sql);
if (!$statement) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
$r = oci_execute($statement, OCI_DEFAULT);
if (!$r) {
$e = oci_error($statement);
echo htmlentities($e['message']);
exit;
}
 
while ($row_nom = oci_fetch_array($statement)) {
$id=$row_nom['ID'];
$X=$row_nom['ABSCISSE'];
$Y=$row_nom['ORDONNEE'];
$longueur=$row_nom['LONGUEUR'];
$largeur=$row_nom['LARGEUR'];?>
<td><input type="checkbox" value= "<?php $id; ?>" name="choix[]"/>
<td ><?php echo $id ; ?></td>
<td><?php echo $X ; ?></td>
<td><?php echo $Y ; ?></td>
<td><?php echo $longueur ; ?></td>
<td><?php echo $largeur ; ?></td></td>
<td> <input type="submit" name="source" value="source" /></td>
 
 
</tr>
<?php } ?>
<tr align="center">
<td colspan="8" font-size="30px"><input type="submit" name="effectuer" value="Effectuer" style="width:130px; height:40px; " /></td>
</tr>
<?php
if(isset($_POST['effectuer'])){
$conn = oci_connect('biat', 'biat','localhost/XE');
$nom=$_POST['nom'];
$aDoor = $_POST['choix'];
$checked_count = count($_POST['choix']);
foreach($_POST['choix'] as $selected) {
$query = "INSERT INTO DIVISION3(ID,ABSCISSE,ORDONNEE,LONGUEUR,LARGEUR,NOMBRE) VALUES ($id','$X','$Y','$longueur','$largeur','$nom') ";
$statement = oci_parse($conn, $query);
 
 
if (!$statement) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
 
$r = oci_execute($statement);
if (!$r) {
$e = oci_error($statement);
echo htmlentities($e['message']);
exit;
}
 
}
 
}
?> </table>
</table>
s'il vous plaît j'ai besoin de votre aide et merci d'avance