Bonjour a tous , j'ai pour projet de créer un site :
le problème c'est que je n'arrive pas a insérer les données de mes formulaires dans ma bdd.
j'ai une erreur qui s'affiche aussi: Echec :SQLSTATE[23000]: Integrity constraint violation: 1048 Le champ 'nom' ne peut �tre vide (null)
je vous laisse le code,si quelqu'un peut m'aider, ça m'économiserais un arrachage de cheveux

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
 
<form action="ajout-anime.php" method="POST"> 
 
  <label style="font-size: 1.2em;">Nom de l'anime:</label> 
<input name="nom"  style="font-size: 1em;width: 60%; height:20px;border-radius: 4px; box-shadow: 1px 1px 2px 2px red ;  " /> 
 
</br></br> 
 
 
    <label style="color:green;" >Genre Principale :</label> 
 
    <select name="genre1"> 
<option>Gore/Horreur</option> 
<option>Mecha</option> 
<option>Seinen</option> 
<option>Shonen</option> 
<option selected>Shojo</option> 
<option>Aventure</option> 
<option>Action</option> 
<option>Ecchi</option> 
</select>  
 
 <label style="color:green;padding-left: 15px;"> Genre Secondaire :</label> 
 
    <select name="genre2"> 
<option>Gore/Horreur</option> 
<option>Mecha</option> 
<option>Seinen</option> 
<option>Shonen</option> 
<option selected>Shojo</option> 
<option>Aventure</option> 
<option>Action</option> 
<option>Ecchi</option> 
</select>  
</br></br>  
 
 
<p style="font-size: 1.2em;">Nombre d'épisode(s):</p><input type="number" name="nombre_episode" value="12"> 
</br></br> 
 <label style="font-size: 1.2em";>Public :</br></br></label> 
 <input type="radio" name="pegi" value="Tout Public :"/><span style="color:green;">Tout Public</span> 
<input type= "radio" name="pegi" value="-12 ans"/><span style="color:yellow;">-12 ans</span> 
<input type= "radio" name="pegi" value="-16 ans"/><span style="color:orange;">-16 ans</span> 
<input type= "radio" name="pegi" value="-18 ans"/> <span style="color:red;">-18 ans</span> 
<div id='structure_liens'> 
<label>Résumé de l'anime :</label> 
<textarea style="height: 200px;width: 100%;border-radius: 5px;margin-left:-4px"></textarea> 
 
</div> 
 
</br></br>   
<div style="text-align: center;"> 
    <input type="submit" class="submit1"/> 
    </div> 
  </form> 
 
 
 
 
<?php 
$serveur='localhost'; 
$login='root'; 
$pass=''; 
try{     
$connexion = new PDO("mysql:host=$serveur;dbname=anime-nian", $login, $pass); 
$connexion->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); 
 
$requete=$connexion->prepare("INSERT INTO anime(nom,pegi,genre1,genre2,nombre_episode,description) VALUES( 
  :nom,:pegi,:genre1,:genre2,:nombre_episode,:description)"); 
$requete->bindParam(':nom',$_POST['nom']); 
$requete->bindParam(':pegi',$_POST['pegi']); 
$requete->bindParam(':genre1',$_POST['genre1']); 
$requete->bindParam(':genre2',$_POST['genre2']); 
$requete->bindParam(':nombre_episode',$_POST['nombre_episode']); 
$requete->bindParam(':description',$_POST['description']); 
 
$requete->execute(); 
} 
catch(PDOException $e){  
  echo'Echec : .$e->getMessage(); 
}  

    ?>