Bon voila, j'ai un souci car l'insertion dans ma base de donnée ne marche pas...
En fait j'ai l'impression que ça ne vient pas de la requete qui m'a l'air bien..
Bref, je vous laisse regarder :
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
 
<?php
include ('../function.class.php'); // bdd
include ('function.class.php'); // constructeur
 
//recuperation du parametre d'url
$id_liste = $_GET['liste'];
echo $id_liste."<br/>";
 
//connexion à la bdd
$db = connect_db();
 
//$editFormAction = $_SERVER['PHP_SELF'];
//if (isset($_SERVER['QUERY_STRING'])) {
//  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
//}
echo $_POST["MM_insert"];
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ajout_contact")) 
{
  $insertSQL = sprintf("INSERT INTO mailing_liste (id_liste, nom, mail) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['id_liste'], "int"),
                       GetSQLValueString($_POST['nom'], "text"),
                       GetSQLValueString($_POST['mail'], "text"));
 
  echo $insertSQL;
  $Result1 = mysql_query($insertSQL, $db) or die(mysql_error());
 
  $addGoTo = "ajout_contact.php";
  if (isset($_SERVER['QUERY_STRING'])) 
  {
    $addGoTo .= (strpos($addGoTo, '?')) ? "&" : "?";
    $addGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $addGoTo));
}
 
//$requete = "select * from liste where id_client='1'";
//$result = mysql_query ($requete,$db);
//$listes = mysql_fetch_object($result);
?>
<!--suit le code html avec head et tout le tralala...-->
<!--puis la ou ça se complique le formulaire...-->
<form id="ajout_contact" name="ajout_contact" method="post" action="ajout_contact.php">
  <table>
    <tr>
      <td>Nom : </td>
      <td><label>
        <input name="nom" type="text" id="nom" />
      </label></td>
    </tr>
    <tr>
      <td>Adresse mail : </td>
      <td><label>
        <input name="mail" type="text" id="mail" />
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><label>
        <input name="submit" type="submit" id="submit" value="Envoyer" />
      </label></td>
      <td><label>
        <input name="reset" type="reset" id="reset" value="R&eacute;initialiser" />
      </label></td>
    </tr>
  </table>
  <input name="id_liste" type="hidden" id="id_liste" value="<?php echo $id_liste; ?>"/>
      </form>
Dites moi si je me trompe en mettant certaines lignes en commentaires parce qu'elle me paraisse inutile et sachez que c'etait pareil quand elle etait pas en commentaire (je pense notamment au ligne avec $editFormAction)

Le nom de mon fichier est bien ajout_contact.php
Voila..