Je suis une bille en javascript et jquery, voici mon problème:
Je suis sur une page index.php qui affiche toutes les fiches via un while
sur chaque fiche, j'ai un lien qui me permet de valider ou invalider chaque fiche
Code : Tout sélectionner
<head>
include('validation.php');
</head>
while ($ligne = $reponse->fetch()) {
$id = $ligne['id'];
$fait = $ligne['fait'];
$date = $ligne['date'];
$numerosemaine = ucfirst(utf8_encode(strftime('%W',strtotime($date))));
$dateentiere = ucfirst(utf8_encode(strftime('%A %d %B %Y',strtotime($date))));
//------------ Affiche les enregistrements de la Semaine Actuelle -------------------------
include('alerte.php');
echo"<div class='afaire'>
<form action='?id=$id' method='post' id='fait' >";
if($ligne['fait']=='non'){
echo"<a href='".$alerte."' title='Validation' ><img src='../../img/avalider.png' width='40' height='40' alt='Validation' />Validation</a>";
}
if($ligne['fait']=='oui'){
echo"<a href='".$alerte."' title='InValidation' ><img src='../../img/validation.png' width='40' height='40' alt='InValidation' />
InValidation</a>";
}
echo"</form>
</div>";
echo '<div class="listetravaux"><h1> '.'Semaine '.$numerosemaine.'</br>'.$dateentiere.' à : '.substr($ligne['heure'],0,2).'h'.substr($ligne['heure'],3,2).'</br><span class="numeroequipe">Equipe '.$ligne['equipe'].'</span></h1>';
//echo 'Equipe :'.$ligne['equipe'].'';
echo $ligne['descriptif'];
//---------------------------------------------------------------------------------------------------
if($ligne['fait']=='non'){
echo '<h2>Prestation à Réaliser</h2>';
}
if($ligne['fait']=='oui'){
echo '<h3>Prestation Réalisée</h3>';
}
echo "</div>";// <!-- fin de listetravaux -->
} Code : Tout sélectionner
<?php
require_once('../../administrateur/configadmin.php');
$chemin = '../../';
if($ligne['id']<>''){
$text=str_replace('<p>', "", $ligne['descriptif']);
$text=str_replace('</p>', "\\n", $text);
$text=str_replace('<br />', "\\n", $text);
setlocale(LC_TIME, "fr");
$date = $ligne['date'];
$dateentiere = utf8_encode(strftime('%A %d %B %Y',strtotime($date)));
$jourdate=substr($ligne['date'],8,2);
$moisdate=substr($ligne['date'],5,2);
$anneedate=substr($ligne['date'],0,4);
$datedujour = $jourdate.'/'.$moisdate.'/'.$anneedate;
$text = $text."\\n Prestation Du :".$dateentiere;
$alerte = 'javascript:if(confirm("Étes-vous sûr de vouloir Modifier cette Prestation : \\n'.$text.' ?")) {
window.location.href="index.php?dirsuppr='.$ligne['id'].'";
}';
}
?>Code : Tout sélectionner
<?php
if (isset($_GET["dirsuppr"])) {
$id = $_GET["dirsuppr"];
$reponse = $bdd->prepare('SELECT * FROM '.$agenda_BDD.' WHERE id LIKE "'.$id.'%" ORDER BY id ASC');
$reponse->bindParam(':id', $id, PDO::PARAM_INT);
// $reponse->bindParam(':equipe', $equipe, PDO::PARAM_INT);
// $reponse->bindParam(':date', $date, PDO::PARAM_STR);
// $reponse->bindParam(':heure', $heure, PDO::PARAM_STR);
// $reponse->bindParam(':descriptif', $descriptif, PDO::PARAM_STR);
$reponse->bindParam(':fait', $fait, PDO::PARAM_STR);
$reponse->execute();
$donnees = $reponse->fetch();
$fait=$donnees['fait'];
$id=$donnees['id'];
if ($donnees['fait'] =="oui"){
$fait = "non";
// Modification dans BDD
$rep =$bdd->prepare('UPDATE '.$agenda_BDD.' SET fait=:fait WHERE id=:id');
$rep->bindParam(':id', $id, PDO::PARAM_INT);
$rep->bindParam(':fait', $fait, PDO::PARAM_STR);
$rep->execute();
$rep -> closeCursor();
echo"<meta http-equiv='refresh' content='0;URL=index.php' />";
}
if ($donnees['fait'] =="non"){
$fait = "oui" ;
// Modification dans BDD
$rep =$bdd->prepare('UPDATE '.$agenda_BDD.' SET fait=:fait WHERE id=:id');
$rep->bindParam(':id', $id, PDO::PARAM_INT);
$rep->bindParam(':fait', $fait, PDO::PARAM_STR);
$rep->execute();
$rep -> closeCursor();
echo"<meta http-equiv='refresh' content='0;URL=index.php' />";
}
}
?> Si vous avez une solution, je suis preneur
Merci beaucoup