Bonjour à toutes et à tous,
voila j'ai programmé une fiche de renseignement en 2 pages
1ere le formulaire :
le seconde la page enregistement :
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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133 <?php // Page faisant appel aux sessions session_start(); // Vérification de l'autorisation if (!$_SESSION["id"]) { // Si l'utilisateur n'est pas autorisé il est reconduit // sur le formulaire d'identification header("Location: ../../../log.php"); // ici la page de log die(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>modification dee l'intervention</title> <style type="text/css"> body { background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.7); } select { width : 250px ; } .Style14 { font-size: 24px; color: #FFFFFF; } .Style15 {color: #FFFFFF} </style> </head> <body> <script> document.addEventListener("contextmenu", function(e){ e.preventDefault(); alert('Page protégée, clic droit interdit'); }, false); </script> <form name="insertion" action="ajout_fiche.php" method="POST"> <input type="hidden" name="id" id="id" value="<?php echo $id;?>"> <p> </p> <table width="1009" border="0" align="center" cellspacing="0"> <tr> <td width="55"><span class="Style20"><a href="annuaire_interne.php"><img src="../../images/Retour.png" title="RETOUR"/></a></span></td> <td width="944"><div align="center" class="Style20 Style14">Création d'une fiche</div></td> </tr> </table><br /> <table width="800" border="1" align="center"> <tr> <td bgcolor="#990000"><span class="Style13 Style15">Nom :</span></td> <td><div align="left"> <input type="text" name="nom" id="nom" size="50" maxlength="255" style="text-transform: capitalize;"value =""/> <input type="text" name="id" id="id" size="15" maxlength="255" style="display:none"; value =""/> </div></td> </tr> <tr> <td bgcolor="#990000"><span class="Style13 Style15">Lieu :</span></td> <td><input type="text" name="lieu" id="lieu" size="50" maxlength="255" style="text-transform: capitalize;" value ="" onkeyup="javascript:this.value=this.value.toUpperCase();" /></td> </tr> <tr> <td bgcolor="#990000"><span class="Style13"><span class="Style15">Etablissement </span>:</span></td> <td><div align="left"> <input type="text" name="etablissement" id="etablissement" size="50" maxlength="255" style="text-transform: capitalize;" value ="" onkeyup="javascript:this.value=this.value.toUpperCase();" /> </div></td> </tr> <tr> <td width="190" bgcolor="#990000"><div align="center" class="Style12 Style15"> <div align="left" class="Style13">Service :</div> </div></td> <td width="594"><div align="left"> <input type="text" name="service" id="service" size="50" maxlength="255" style="text-transform: capitalize;" value ="" onkeyup="javascript:this.value=this.value.toUpperCase();" /> </div></td> </tr> </table> <br /> <table width="800" border="1" align="center"> <tr> <td width="191" height="28" bgcolor="#990000"><span class="Style13 Style15">tel_interne :</span></td> <td width="593"><div align="left"> <input type="text" name="tel_interne" id="tel_interne" size="50" maxlength="255" style="text-transform: capitalize;" value ="" onKeyUp="javascript:this.value=this.value.toUpperCase();" /> </div></td> </tr> <tr> <td bgcolor="#990000"><span class="Style13 Style15">tel_direct :</span></td> <td><div align="left"><span class="zone_texte"> <input type="text" name="tel_direct" id="tel_direct" size="50" maxlength="255" value =""/> </textarea> </span></div></td> </tr> <tr> <td bgcolor="#990000"><span class="Style13 Style15">tel_port_interne :</span></td> <td><div align="left"><span class="zone_texte"> <input type="text" name="tel_port_interne" id="tel_port_interne" size="50" maxlength="255" style="text-transform: capitalize;" value =""/> </span></div></td> </tr> <tr> <td bgcolor="#990000"><span class="Style15">tel_port_direct :</span></td> <td><span class="zone_texte"> <input type="text" name="tel_port_direct" id="tel_port_direct" size="30" maxlength="255" style="text-transform: capitalize;" value ="" onkeyup="javascript:this.value=this.value.toUpperCase();"/> </span></td> </tr> <tr> <td bgcolor="#990000"><span class="Style15">fax :</span></td> <td><span class="zone_texte"> <input type="text" name="fax" id="fax" size="30" maxlength="255" style="text-transform: capitalize;" value ="" onkeyup="javascript:this.value=this.value.toUpperCase();"/> </span></td> </tr> <tr> <td bgcolor="#990000"><span class="Style15">observation :</span></td> <td><span class="zone_texte"> <input type="text" name="observation" id="observation" size="80" maxlength="255" style="text-transform: capitalize;" value =""/> </span></td> </tr> </table> <br /> <div align="center"></div> <div align="center"> <input type="submit" value="Valider" /> <input type="reset" value="Recommencer" /> </div> </form> </body> </html>
tout fonctionne mais quand je regarde ma table, l'enregistrement s'affiche 2 fois
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
45
46 <?php //connection au serveur $conn = mysqli_connect('*****', '******', '*****', '*****'); //modification des caractères avec accents mysqli_query($conn,"SET CHARACTER SET 'utf8'"); mysqli_query($conn,"SET SESSION collation_connection ='utf8_unicode_ci'"); //récupération des valeurs des champs: $id = $_POST["id"] ; $nom = $_POST["nom"] ; $service = $_POST["service"] ; $lieu = $_POST["lieu"] ; $etablissement = $_POST["etablissement"] ; $tel_interne = $_POST["tel_interne"] ; $tel_direct = $_POST["tel_direct"] ; $tel_port_interne = $_POST["tel_port_interne"] ; $tel_port_direct = $_POST["tel_port_direct"] ; $fax = $_POST["fax"] ; $observation = $_POST["observation"] ; //création de la requête SQL: $sql = "INSERT INTO annuaire_interne(id , nom, service, lieu, etablissement, tel_interne, tel_direct, tel_port_interne, tel_port_direct, fax, observation) VALUES ( '$id' ,'$nom', '$service', '$lieu', '$etablissement', '$tel_interne', '$tel_direct', '$tel_port_interne', '$tel_port_direct', '$fax', '$observation') " ; //exécution de la requête SQL: $requete = $conn->query($sql); //exécution de la requête SQL: $requete = $conn->query($sql); //affichage des résultats, pour savoir si la modification a marchée: if($requete) { header("location:" . "annuaire_interne.php"); } else { header("location:" . "annuaire_interne.php"); } ?>
pouvez vous me dire d'où vient le souci
Merci à tous
Partager