You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.9 KiB

<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="css/jquery-3.5.1.js"></script>
<link rel="stylesheet" href="css/VueAdmin.css">
</head>
<body>
<form style="border:1px solid #ccc" method="GET" action="Traitement/AjoutQuestion.php">
<div class="container">
<h1>Ajouter une question(QCM)</h1>
<hr>
<label><b>Consigne : </b></label>
<input type="text" placeholder="Ecrire l'intitulé de la démonstration..." id="consigne" required>
<label><b>Réponse 1 : </b></label>
<input type="text" id="choix1" required>
<label><b>Réponse 2 : </b></label>
<input type="text" id="choix2" required>
<label><b>Réponse 3 : </b></label>
<input type="text" id="choix3" required>
<label><b>Bonne(s) Réponse(s) ? </b><br/>
<input type="checkbox" id="rep1" name="reponse" value="1" style="margin-bottom:15px" > 1 <br/>
<input type="checkbox" id="rep2" name="reponse" value="2" style="margin-bottom:15px"> 2 <br/>
<input type="checkbox" id="rep3" name="reponse" value="3" style="margin-bottom:15px"> 3 <br/>
</label><br/>
<div >
<input type="button" value="Ajouter" onclick="SubmitAjoutQCM()" />
</div>
</div>
</form>
<div id="erreur">
</div>
<form method="get">
<input id="inp-qcm" class="bouton" type="submit" name="action" value="QCM" >
</form>
</body>
<script>
function SubmitAjoutQCM() {
//var chapitre = $('#chapitre').val() ;
var numQuestion = $('#numQuestion').val() ;
var consigne = $('#consigne').val() ;
var choix1= $('#choix1').val() ;
var choix2= $('#choix2').val() ;
var choix3= $('#choix3').val() ;
var rep1 = $('#rep1').is(':checked');
var rep2 = $('#rep2').is(':checked');
var rep3 = $('#rep3').is(':checked');
//var reponse = $('#reponse').val() ;
//var reponse = $("input[name='reponse']:checked").val();
$.get("Traitement/AjoutQCM.php", {numQuestion: numQuestion,consigne: consigne,choix1: choix1,choix2: choix2,choix3: choix3,rep1 : rep1, rep2 : rep2, rep3 : rep3},
function(data) {
$('#erreur').html(data);
if (data.includes("AJOUT") == true){
var result = confirm("La question a été ajoutée. Afficher les QCM ?");
if(result) $('#inp-qcm').trigger("click");
}
//$('#demoForm')[0].reset();
});
}
</script>
</html>