onclick="GO('<?=$liste_etu['id_sc']?>')"
GO(id_sc)
<?php
$color=array('#333333','#999999');
$i=0;
// on crée la requête SQL
$sql = "SELECT *
FROM ServiceCourrier WHERE accuse_corbeille = '0' AND accuse_archive = '0'
ORDER BY NumEnreg ASC
";
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$res = mysql_num_rows($req); // 4
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
.Style2 {color: #0000FF}
.Style8 {
color: #330000;
font-style: italic;
}
.Style10 {color: #330000; font-weight: bold; font-style: italic; }
-->
</style>
</head>
<body>
<p> </p>
<div class="info_sev_cour" style="position:absolute; top:20px; left:10px; font-size:14px">
<table width="1082" border="0" align="center" cellspacing="2">
<tr bgcolor="#999999">
<th colspan="2" bgcolor="#999999" scope="row"><p class="Style8">N°</p>
<p class="Style8"> COURRIER</p></th>
<td width="106" bgcolor="#999999"><div align="center" class="Style10">DATE ARRIVEE DU COURRIER</div></td>
<td width="275" bgcolor="#999999"><div align="center" class="Style10">NOM EXPEDITEUR</div></td>
<td width="119" bgcolor="#999999"><div align="center" class="Style10">DATE DU COURRIER</div></td>
<td width="86" bgcolor="#999999"><div align="center" class="Style10">N° D'ORIGINE </div></td>
<td width="94" bgcolor="#999999"><div align="center" class="Style10">OBJET</div></td>
<td width="147" bgcolor="#999999"><div align="center" class="Style10">FICHIER</div></td>
<td colspan="3" bgcolor="#999999"> </td>
</tr>
<?php
while ($liste_etu=mysql_fetch_assoc($req)) {
$j=$i%2;
//$rq = mysql_query("SELECT * FROM ServiceCourrier WHERE NumEnreg = '".$liste_etu['num']."' AND clef = '".$liste_etu["clef"]."'") or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
//$liste = mysql_fetch_assoc($rq);
$checked = $liste_etu["accuse_trait"]==1? "checked = 'checked'": "";
$style=($checked)? "font-weight:bold !important; color:#FF8000; " : "";
$class=($checked)? "numbers4 " : "";
?>
<tr bgcolor="#33FFFF" <?php echo 'style="'.$style.'"' ?> >
<td width="38" bgcolor="#F0F0F0"><span class="Style10">
<div <?php echo 'class="'.$class.'"' ?> align="center"><input type="checkbox" name="accuseimput" <?php echo $checked ?> onclick="GO('<?=$liste_etu['id_sc']?>')" /></div>
</span></td>
<td width="61" bgcolor="#F0F0F0" ><span class="numbers4" style="color:#FFF"><?php echo $liste_etu['NumEnreg'];?></span></td>
<td bgcolor="#F0F0F0"><?php echo $liste_etu['dateArriveCourrier'];?></td>
<td bgcolor="#F0F0F0" style="font-size:12px"><?php echo $liste_etu['nomExpediteur'] ?></td>
<td bgcolor="#F0F0F0" style="font-size:12px"><?php echo $liste_etu['dateDuCourrier'] ?></td>
<td bgcolor="#F0F0F0" style="font-size:12px"><?php echo $liste_etu['Numorigine'] ?></td>
<td bgcolor="#F0F0F0" style="font-size:12px"><?php echo $liste_etu['objetCourrier'] ?></td>
<td bgcolor="#F0F0F0" style="font-size:12px"><table width="147" border="0" align="center">
<tr>
<td width="22"><a href="index.php?page=galerie_photo&id=<?php echo $liste_etu['id_sc']; ?>"><img src="images/trombone2.gif" width="20" height="25" /></a></td>
<td width="115"><a href="index.php?page=galerie_photo&id=<?php echo $liste_etu['id_sc']; ?>" style="text-decoration:none">Pièces Jointes</a></td>
</tr>
</table></td>
<td width="37" bgcolor="#F0F0F0" style="font-size:12px"><a href="index.php?page=groupe_LISTE_modif&id=<?php echo $liste_etu['id_sc']; ?>" style="text-decoration:none; color:#000; font-weight:bold; font-size:13px" ><img src="images/modiff.png" width="30" height="30" /></a></td>
<td width="38" bgcolor="#F0F0F0" style="font-size:12px" align="center"><a href="index.php?page=accuce_corbeille&id=<?php echo $liste_etu['id_sc']; ?>" style="text-decoration:none; color:#000; font-weight:bold; font-size:13px" ><img src="images/suppr.png" width="20" height="20" /></a></td>
<td width="35" bgcolor="#F0F0F0" style="font-size:12px"><a href="index.php?page=LISTE_archiver&id=<?php echo $liste_etu['id_sc']; ?>" style="text-decoration:none; color:#000; font-weight:bold; font-size:13px" >ARCHIVER</a></td>
</script>
<?php
}
?>
</table>
</div>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="functions/jquery.js"></script>
<script type="text/javascript">
function GO(id_sc){
alert('ok');
console.log("***** Fonction GO("+id_sc+") ******* ");
var AJX = $.ajax({
type: "POST"
,url:"pages/page2.php"
,data: "id="+id_sc
,async: false
,dataType: "text"
,success: function(reponse){
console.log("Le script fonctionne !!");
alert(reponse);
}
,error:function(){
console.log(" error !!");
alert('Ajax => Erreur ');
}
});
}
</script>
</body>
</html>
<?php
// Le début de ton code
// ...
// On regarde si tes variables GET sont renseignées:
print_r($_GET);
// On récupère l'ID
$id = isset($_GET["id"])?$_GET["id"]:'';
// Activation du compte utilisateur
$sql="UPDATE servicecourrier
SET accuse_trait = '1'
WHERE id_sc = '".$id."'";
$result = mysql_query($sql);
// On retourne le résultat dans la fonction ajax
if($result){
print_r($result);
}else{
echo "<br><b>REQUETE :</b><br>".$sql;
}
?>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question// .... $checked = $liste_etu["accuse_trait"]==1? "checked = 'checked'": ""; $style=($checked)? "font-weight:bold !important; color:#FF8000; " : ""; $class=($checked)? "numbers4 " : ""; // Echo pour savoir ce que vaut id_sc ! echo "<br><b> ID_SC = </b>".$liste_etu['id_sc']; // Le reste de ton code
// Echo pour savoir ce que vaut id_sc !me donne :
echo "<br><b> ID_SC = </b>".$liste_etu['id_sc'];
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript" src="functions/jquery.js"></script> <title>Document sans titre</title> <style type="text/css"> <!-- .Style2 {color: #0000FF} .Style8 { color: #330000; font-style: italic; } .Style10 {color: #330000; font-weight: bold; font-style: italic; } --> #TblMails{ margin-bottom: 20px; } #TblMails th{ background-color:#999999; text-align:center; } #TblMails td{ background-color:#F0F0F0; text-align:left; font-size:12px; } #TblMails a{ text-decoration:none; color:#000; font-weight:bold; font-size:13px } </style> </head> <body> <?php $color=array('#333333','#999999'); $i=0; // on crée la requête SQL $sql = "SELECT * FROM ServiceCourrier WHERE accuse_corbeille = '0' AND accuse_archive = '0' ORDER BY NumEnreg ASC "; // on envoie la requête $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); $res = mysql_num_rows($req); // 4 ?> <p> </p> <div class="info_sev_cour" style="position:absolute; top:20px; left:10px; font-size:14px"> <table id="TblMails" width="1082" border="0" align="center" cellspacing="2"> <tr> <th colspan="2" scope="row"><p class="Style8">N°</p><p class="Style8"> COURRIER</p></th> <th width="106" ><div align="center" class="Style10">DATE ARRIVEE DU COURRIER</div></th> <th width="275"><div align="center" class="Style10">NOM EXPEDITEUR</div></th> <th width="119"><div align="center" class="Style10">DATE DU COURRIER</div></th> <th width="86" ><div align="center" class="Style10">N° D'ORIGINE </div></th> <th width="94" ><div align="center" class="Style10">OBJET</div></th> <th width="147" ><div align="center" class="Style10">FICHIER</div></th> <th colspan="3" > </td> </tr> <?php while ($liste_etu=mysql_fetch_assoc($req)) { $j=$i%2; $checked = $liste_etu["accuse_trait"]==1? "checked = 'checked'": ""; $style=($checked)? "font-weight:bold !important; color:#FF8000; " : ""; $class=($checked)? "numbers4 " : ""; ?> <tr <?='style="'.$style.'"' ?> > <td width="38" ><span class="Style10"> <div <?='class="'.$class.'"' ?> align="center"><input type="checkbox" name="accuseimput" <?=$checked ?> onclick="GO('<?=$liste_etu['id_sc']?>')" /></div> </span></td> <td width="61" ><span class="numbers4" style="color:#FFF"><?=$liste_etu['NumEnreg'];?></span></td> <td><?=$liste_etu['dateArriveCourrier'];?></td> <td><?=$liste_etu['nomExpediteur'] ?></td> <td><?=$liste_etu['dateDuCourrier'] ?></td> <td><?=$liste_etu['Numorigine'] ?></td> <td><?=$liste_etu['objetCourrier'] ?></td> <td><table width="147" border="0" align="center"> <tr> <td width="22"><a href="index.php?page=galerie_photo&id=<?=$liste_etu['id_sc']; ?>"><img src="images/trombone2.gif" width="20" height="25" /></a></td> <td width="115"><a href="index.php?page=galerie_photo&id=<?=$liste_etu['id_sc']; ?>" style="text-decoration:none">Pièces Jointes</a></td> </tr> </table> </td> <td width="37"style="text-align:center !important;"> <a href="index.php?page=groupe_LISTE_modif&id=<?=$liste_etu['id_sc']; ?>" ><img src="images/modiff.png" width="30" height="30" /></a> </td> <td width="38" style="text-align:center !important;"> <a href="index.php?page=accuce_corbeille&id=<?=$liste_etu['id_sc']; ?>" ><img src="images/suppr.png" width="20" height="20" /></a> </td> <td width="35"style="text-align:center !important;"> <a href="index.php?page=LISTE_archiver&id=<?=$liste_etu['id_sc']; ?>" >ARCHIVER</a> </td> <?php } ?> </table> </div> <script type="text/javascript"> function GO(id_sc){ alert('ok'); console.log("***** Fonction GO("+id_sc+") ******* "); var AJX = $.ajax({ type: "POST" ,url:"pages/page2.php" ,data: "id="+id_sc ,async: false ,dataType: "text" ,success: function(reponse){ console.log("Le script fonctionne !!"); alert(reponse); } ,error:function(){ console.log(" error !!"); alert('Ajax => Erreur '); } }); } </script> </body> </html>
function GO(id_sc){ alert('ok'); console.log("***** Fonction GO("+id_sc+") ******* "); var AJX = $.ajax({ type: "GET" ,url:"pages/page2.php" ,data: "id="+id_sc ,async: false ,dataType: "text" ,success: function(reponse){ console.log("Le script fonctionne !!"); alert(reponse); } ,error:function(){ console.log(" error !!"); alert('Ajax => Erreur '); } }); }
function UPDATE_servicecourrier(id_sc){ alert('ok'); console.log("***** FonctionUPDATE_servicecourrier("+id_sc+") ******* "); var AJX = $.ajax({ type: "GET" ,url:"pages/page2.php" ,data: "id="+id_sc ,async: false ,dataType: "text" ,success: function(reponse){ console.log("Le script fonctionne !!"); alert(reponse); } ,error:function(){ console.log(" error !!"); alert('Ajax => Erreur '); } }); }
<td width="38" > <span class="Style10"> <div <?='class="'.$class.'"' ?> align="center"> <input type="checkbox" name="accuseimput" <?=$checked ?> onclick="UPDATE_servicecourrier('<?=$liste_etu['id_sc']?>')" /> </div> </span> </td>
<input type="checkbox" name="accuseimput" <?=$checked ?> onclick="alert(' GO UPDATE..');UPDATE_servicecourrier('<?=$liste_etu['id_sc']?>')" />
<input type="checkbox" onclick="alert(' GO UPDATE..');UPDATE_servicecourrier('41')" name="accuseimput"></input>
onclick="UPDATE_servicecourrier('<?=$liste_etu['id_sc']?>')"par
onclick="UPDATE_servicecourrier('<?php echo $liste_etu['id_sc']; ?>')"