Ma requête UPDATE ne fonctionne pas
Bonjour,
Je n'arrive pas à modifier mon formulaire.
J'ai deux pages :
Page 1 : modification_suppression_structure.php : permet de rechercher un nom afin de le modifier
Page 2 : lecture_structure.php : permet d'afficher les champs après la recherche
Voici le code de la page 1 :
Code:
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
| <?php
if (isset($_POST['modifier'])){
echo"holla";
$thematique=addslashes($_POST['thematique']);
$nv_nom_contact=addslashes($_POST['nv_nom_contact']);
$desc_contact=addslashes($_POST['desc_contact']);
$nom_struct=addslashes($_POST['nom_struct']);
$nom_service=addslashes($_POST['nom_service']);
$adres_struct=addslashes($_POST['adres_struct']);
$pays=$_POST['country'];
$code_postal=$_POST['postalcode'];
$ville=addslashes($_POST['place']);
$tel_struct=$_POST['tel_struct'];
$fax_struct=$_POST['fax_struct'];
$page_web=addslashes($_POST['page_web']);
$mail_struct=$_POST['mail_struct'];
$date_ajout = date('Y-m-d H:i:s'); //filemtime('modification_structure.php');
$filename='modification_suppression_structure.php';
$date_maj = date("Y-m-d H:i:s", filemtime($filename));
$nom_contact=$_POST['nom_contact']; //contact à rechercher
$reponse = $bdd->query("SELECT * FROM structure WHERE nom_contact='$nom_contact'");
$donnees = $reponse->fetch(PDO::FETCH_ASSOC);
$id= $donnees['id_struct'];
PRINT_r($donnees).'<br />';
$bdd->exec("UPDATE structure SET nom_contact='$nv_nom_contact', desc_contact='$desc_contact',nom_struct='$nom_struct',nom_service='$nom_service',adres_struct='$adres_struct',code_postal='$code_postal',ville='$ville',pays='$pays',tel_struct='$tel_struct',fax_struct='$fax_struct',mail_struct='$mail_struct',page_web='$page_web' WHERE id_struct= '$id'");
} |
En fait, j'ai besoin de print_r($_POST) et de print-r($_donnees) pour afficher toutes les informations. Ceci parce que dans ma page 2, j'ai le code d'affichage des champs ( $donnee['champ'] ).
Merci