Bonjour à tous,
J'ai un soucis dans la récupération des infos à travers des boutons radios.
Donc j'utilise la méthode $_POST mais rien n'y fais. je ne sais pas l'erreur que je fais, quelqu'un peut-m'élaircir ?!
mon formulaire :
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; ?> <p>Pour supprimer une photographie de la base de données, veuillez sélectionner l'image à supprimer parmis les suivantes :</p> <table border="0" cellspacing="0" cellpadding="3"> <?php $renvoi = mysql_query('SELECT * FROM photos'); echo mysql_error(); $indexLigne = 0; echo'<th>Photographie</th>'; echo'<th>Nom</th>'; echo'<th>Gamme</th>'; echo'<th>Choix</th>'; while($tableau = mysql_fetch_assoc($renvoi)) { if($indexLigne%2==0) { echo '<tr class="LignePaire">'; } else { echo '<tr class="Ligne">'; } $image = $tableau["nom_image"]; echo'<td><img src="'.$content_dirPhoto.$image.'" width="100" height="100"/></td>'; echo"<td>".$image."</td>"; echo'<td>'.$tableau["gamme"].'</td>'; echo'<td><input type=radio name="choix_image" value="'.$nom_image.'"></td>'; echo'</tr>'; $indexLigne++; } echo'<tr>'; echo'<td></td>'; echo'<td> <input type="submit" name="submit" value="Valider"> </td>'; echo'</tr>'; echo'</table>'; echo'<input type="hidden" name="preSupprimePhoto" value="preSupprimePhoto">'; echo'</form>'; } } mysql_close(); } } ?>
l'affichage :
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 if(isset($_POST["preSupprimePhoto"])) { echo'<p>Vous avez choisi de supprimer la photographie, dont le nom est '.$_POST["choix_image"].', suivante :</p>'; $_SESSION["path_photo_choisie"] = $content_dirPhoto.$_POST["choix_image"]; $_SESSION["photo_choisie"] = $_POST["choix_image"]; echo'<p>'.$_SESSION["path_photo_choisie"].'</p>'; echo'<form method="post" action="'.$_SERVER["PHP_SELF"].'">';?> <p>Si les informations sont correctes, vous pouvez supprimer, sinon appuyez sur modifier pour choisir une autre photographie.</p> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td> <input type="submit" name="suppressionPhoto" value="Supprimer"> </td> <td> <input type="submit" name="modifierPhoto" value="Modifier"> </td> </tr> </table> </form>
Partager