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 39 40 41 42 43 44 45 46 47 48 49 50
| <?php
//inclure de base donne
$sql = "SELECT *
FROM publication
left join question_a_choix_multiple on question_a_choix_multiple.ID_PUB=publication.ID_PUB
left join utilisateur on publication.EMAIL_USER=utilisateur.EMAIL_USER
where utilisateur.EMAIL_USER='".$email_user."'
ORDER BY rand()
LIMIT 1 OFFSET 1";
mysql_query("SET NAMES 'utf8'");
$requete = mysql_query( $sql, $connect );
if($requete === FALSE) {
die(mysql_error());
}
while( $result = mysql_fetch_array( $requete) ){
echo $result["LIBELLE_QUES"].'</br>';
echo '</br>';
echo '<form name="questionph" action="">';
if (isset($result["CHOIX1"])){
echo ' <input type="radio" name="mon_champ" id="'.$result["CHOIX1"].'" />'.$result["CHOIX1"].'</br>';
echo '<input type="radio" name="mon_champ" id="'.$result["CHOIX2"].'" />'.$result["CHOIX2"].'</br>';
echo '<input type="radio" name="mon_champ" id="'.$result["CHOIX3"].'" />'.$result["CHOIX3"].'</br>';
if (isset($result["CHOIX4"])){
echo '<input type="radio" name="mon_champ" id="'.$result["CHOIX4"].'" onClick="Radio();"/>'.$result["CHOIX4"].'</br>';
}
}
else echo "</br>Repondez ici : <input name=\"inputrep\" id=\"inputrep\" />";
echo '</ul>';
<script type="text/javascript">
function valider(){
<?php
$nbreussi=$result["NB_REUSSI"];
$sql2="update utilisateur
set NB_REUSSI='".$nbreussi."'
where EMAIL_USER='".$email_user." '";
mysql_query( $sql2, $connect );
if(mysql_query( $sql2, $connect )=== FALSE) {
die(mysql_error()); // TODO: better error handling
}
?>
if (document.getElementById('<?php echo $result["LIBELLE_REP"]; ?>').checked == true) {
$nbreussi++;
}
<?php } //de while ?>
</script> |
Partager