<?php
/*
Configuration
fill those varaibles with your data
*/
$DB_SERVER = "localhost";
$DB_USER = "root";
$DB_PASS = "";
$DB_DATABASE = "madoche";
/******************************************************************/
try {
$connect = new PDO("mysql:host=$DB_SERVER; dbname=$DB_DATABASE", $DB_USER,$DB_PASS);
echo "♫";
}
catch (PDOException $e) {
if (empty($DB_DATABASE)) {
die("<strong>Database Error..! </strong><a href='install'>Start installation</a>") ;
} else {
die("<strong>Database Error..! </strong>") ;
}
}
$connect->query("set charcter_set_server = 'utf8'");
$connect->query("set names'utf8' ");
?>
<?php
if (isset($_POST['ENVOYER'])) {
$Nom=htmlentities($_POST['nom']);
$Prenom=htmlentities($_POST['prenom']);
$Email=htmlentities($_POST['email']);
$Telephone=htmlentities($_POST['telephone']);
$Societe=htmlentities($_POST['entreprise']);
$Ville=htmlentities($_POST['ville']);
$Incident=htmlentities($_POST['incident']);
$Daten=htmlentities($_POST['date']);
$Description=htmlentities($_POST['description']);
$insertion=$connect->prepare("INSERT INTO utilisateur (nom,prenoms) VALUES(:nom,:prenoms);
INSERT INTO contact ( numero,societe,email) VALUES (:telephone,:societe,:email);
INSERT INTO ville(nom) VALUES (:nomvill);
INSERT INTO intcident (nom) VALUES(:nomincid);
INSERT INTO demande (description,moment) VALUES(:description,:moment);"
);
$insertion->execute(array(
':nom' => $Nom,
':prenoms' => $Prenom,
':email' => $Email,
':telephone' => $Telephone,
':societe' => $Societe,
':nomvill' => $Ville,
':nomincid' => $Incident,
':moment' => $Daten,
':description' => $Description,
)
);
if (isset($insertion)) {
$MSG="<div class='alert alert-success center' style='width: 90%; margin: auto; font-size:15px;'><p>Votre Demander a été effectuer avec Success !</p></div><br><br>";
echo $MSG;
}
else {
$MSG="<div class='alert alert-danger center' style='width: 90%; margin: auto;'><p>Error d'ajout</p></div><br><br>";
echo $MSG;
}
echo "<meta http-equiv='refresh' content='1; url = demande.php' />";
}
?>
edit : Ajout des balises de code
Afficher la suite