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
| <?php
//date en France
date_default_timezone_set('Europe/Paris');
if (isset($_POST['valider']))
{
$nom_contact=$_SESSION['nom_contact'];
echo $nom_contact;
$reponse = $bdd->query("SELECT * FROM structure WHERE nom_contact='$nom_contact'");
$donnees = $reponse->fetch(PDO::FETCH_ASSOC);
$id_struct=$donnees['id_struct'];
while ($donnees = $reponse->fetch(PDO::FETCH_ASSOC))
if ($donnees["id_struct"]==$id_struct)
$id_struct=$donnees['id_struct'];
$nationalite=$_POST['nationalite'];
$statut_conflit=$_POST['statut_conflit'];
$etat=$_POST['etat'];
$sexe=$_POST['sexe'];
$age=$_POST['age'];
$particularite=$_POST['particularite'];
$confession=$_POST['confession'];
$institution=$_POST['institution'];
$administrative=$_POST['administrative'];
$aide_sociale=$_POST['aide_sociale'];
$date_ajout = date('Y-m-d H:i:s');
PRINT_r($_POST).'<br />';
/* Exécute une requête préparée en passant un tableau de valeurs */
$sth = $bdd->prepare('SELECT * FROM structure WHERE nom_contact=?');
$sth->execute(array($nom_contact));
while($data=$sth->fetch(PDO::FETCH_ASSOC)){
$insert=$bdd->prepare('INSERT INTO categorisation VALUES (null,?,?,?,?,"4",?,?,?,?,?,?,?,?,NULL)');
$insert->execute(array($data['id_struct'],$data['nationalite'],$data['statut_conflit'],$data['etat'],$data['sexe'],$data['age'],$data['particularite'],$data['confession'],$data['institution'],$data['administrative'],$data['aide_sociale'],$data['date_ajout']));
}
}
?> |
Partager