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
| function gpoint_dossier_generiques_ajouter(){
// On commence par récupérer les champs
if(isset($_POST['text_code_dossier'])) $nom=$_POST['text_code_dossier'];
else $text_code_dossier="";
if(isset($_POST['text_description_dossier'])) $prenom=$_POST['text_description_dossier'];
else $text_description_dossier="";
if(isset($_POST['text_type'])) $email=$_POST['text_type'];
else $text_type="";
if(isset($_POST['text_nds'])) $icq=$_POST['text_nds'];
else $text_nds="";
if(isset($_POST['text_pw'])) $titre=$_POST['text_pw'];
else $text_pw="";
if(isset($_POST['text_actif'])) $url=$_POST['text_actif'];
else $text_actif="";
// On vérifie si les champs sont vides
if(empty($text_code_dossier) OR empty($text_description_dossier) OR empty($text_type) OR empty($text_nds) OR empty($text_pw) OR empty($text_actif))
{
echo '<center><font color="red">Attention, au moins un champ est vide !</font></center>';
}
// Aucun champ n'est vide, on peut enregistrer dans la table
else
{
// on écrit la requête sql
$sql = "INSERT INTO gpoint_dossier_generiques(id_dossier,code_dossier,description_dossier,type,nds,pw,actif) VALUES ('','$code_dossier','$description_dossier','$type','$nds','$pw','$actif')";
// on insère les informations du formulaire dans la table
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
// on affiche le résultat pour le visiteur
echo "<center><font color='red'>Le dossier générique a été créée !</font></center>";
echo "<center><a href='modules.php?name=GPOINT'>Revenir au menu</a></center>";
}
} |
Partager