Bonjour,
j'ai un formulaire d'insertion dont le résultat est dans la même page;on cliquant sur le bouton l'insertion marche mais le problème lorsque j'actualise la page le dernier enregistrement se rajoute une autre fois;
voilà mon script si vous pouvez m'aidez svp:
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
 
<table width="935" border="0" align="center" bordercolor="#999999" bgcolor="#D0E4F4">
  <tr>
    <td height="53"><form id="form1" name="form1" method="post" action="">
 
      <strong>Marque:</strong>
      <label>
      <input name="lib" type="text" id="lib" />
      </label>
        <label> </label>
        <label>
        <input type="submit" name="Submit" value="Add" />
        </label>
    </form>    </td>
  </tr>
</table>
 <?php 
 
 
 include ("../conn.php");
 $lib=$_POST['lib'];
 
 
 $requet="INSERT INTO `marque` (`ID_MARQUE`,`LIB_MARQUE`) VALUES ('','$lib');";
  mysql_query($requet,$connexion) or die("Ecriture impossible"); 
 
 
 ?> 
<table align="left" border="0" width="1070" >
<tr>
<td width="218" bgcolor="#6699FF"><div align="center"><em><strong>ID</strong></em></div></td><td width="842" bgcolor="#6699FF"><div align="center"><em><strong>Libellé</strong></em></div></td>
</tr>
 
   <?php 
  $requete=" SELECT  * 
  FROM marque  
	     
;";
 
  $resultat=mysql_query($requete,$connexion);
  $color = 0; 
 
 while($tri=mysql_fetch_row($resultat)) {
 
	 $color % 2 ? $bgcolor = '#eeeeee' : $bgcolor = '#cccccc';
		 echo '<tr bgcolor="'.$bgcolor.'">';
 
		   echo "<td>".$tri[1]."</td>";
	       echo "<td align='center'>".$tri[0]."</td>";
 
 
		 echo"</tr>";
 $color++;  
	 }
 
 
 ?> 
</table>