Bonjour,

Voilà j'ai créé un formulaire pour insérer des données dans une table id_coaching, seulement il ne marche pas et j'arrive pas à comprendre ce que j'ai fait de faux...

Il ne me répond aucune erreur, il me renvoie sur ma page index mais les données ne s'enregistre pas...

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
<?php
// Si les variables existent	
if (isset($_POST['date']) AND isset($_POST['coach']) AND isset($_POST['duree']) AND isset($_POST['resume']) AND isset($_POST['pointmes']) AND isset($_POST['tarif'])) 
{
	// Si on a quelque chose à enregistrer
    if ($_POST['date'] != NULL AND $_POST['coach'] != NULL AND $_POST['duree'] != NULL AND $_POST['resume'] != NULL AND $_POST['pointmes'] != NULL AND $_POST['tarif'] != NULL) 
 
    {
        // On utilise la fonction PHP htmlentities pour éviter d'enregistrer du code HTML dans la table
        $date = htmlentities ($_POST['date'], ENT_QUOTES);
        $coach = htmlentities ($_POST['coach'], ENT_QUOTES);
		$duree = htmlentities ($_POST['duree'], ENT_QUOTES);
		$resume = htmlentities ($_POST['resume'], ENT_QUOTES);
        $pointmes = htmlentities ($_POST['pointmes'], ENT_QUOTES);
		$tarif = htmlentities ($_POST['tarifs'], ENT_QUOTES);
 
	// On enregistre le message
	if(!empty($_GET['id_indep']))
	{
	mysql_query("INSERT INTO t_coaching (id_coaching, date, coach, duree, resume, pointmes, tarif) VALUES ('', '$date', '$coach', '$duree', '$resume', '$pointmes', '$tarif') WHERE ref_indep=".$_GET['id_indep']."");
	}	
 
	// On se déconnecte de MySQL
	mysql_close();
	}
}
?>
 
<form action="index.php" method="post">
<table width="200" border="0">
  <tr>
    <td width="90" bgcolor="#5395f9"><center><b><u>Date</u></b></center></td>
    <td width="80" bgcolor="#5395f9"><center><b><u>Coach</u></b></center></td>
    <td width="70" bgcolor="#5395f9"><center><b><u>Durée</u></b></center></td>
    <td width="450" bgcolor="#5395f9"><center><b><u>Résumé</u></b></center></td>
    <td width="90" bgcolor="#5395f9"><center><b><u>Points MES</u></b></center></td>
    <td width="70" bgcolor="#5395f9"><center><b><u>Tarifs</u></b></center></td>
  </tr>
  <tr>
    <td><input type="text" name="date" size="9"/></td>
    <td><input type="text" name="coach" size="8"/></td>
    <td><input type="text" name="duree" size="7"/></td>
    <td><textarea name="resume" cols="50"/></textarea></td>
    <td><input type="text" name="pointmes" size="9"/></td>
    <td><input type="text" name="tarif" size="7"/></td>
  </tr>
</table>
<input name="submit" type="submit" value="Enregistrer"/><p><br />
 
<form>
<input type='button' value='Retour' onclick='location.href="index.php?page=index"'/></form>
Quelqu'un voit pourquoi?

merci