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 51 52 53 54 55 56 57 58 59 60 61 62
| <legend>Ajouter des questions </legend>
<form name="form1" method="post" action="ajouter_ques_serie.php" >
<table width="300" border="0" align="center">
<tr>
<td align="center">
<?php
include("classes.php");
$q=Question::lister();
if($q!=null && count($q)>0)
{
echo "<table border=\"0\" align=\"center\">";
echo "<tr bgcolor=\"#006699\">
<th><font color=\"#FFFFFF\">N°question</font></th>
<th><font color=\"#FFFFFF\">Id catégorie </font></th>
<th><font color=\"#FFFFFF\">Question</font></th>
<th><font color=\"#FFFFFF\">Image </font></th>
<th><font color=\"#FFFFFF\">A </font></th>
<th><font color=\"#FFFFFF\">B</font></th>
<th><font color=\"#FFFFFF\">C </font></th>
<th><font color=\"#FFFFFF\">Réponse</font></th>
<th colspan='2'><font color=\"#FFFFFF\">x</font></th>
</tr>";
foreach($q as $enr1)
{
echo"<tr>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["num_q"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["id_categorie"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["contenu"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["image"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["A"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["B"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["C"]."</font></td>
<td bgcolor=\"#3399CC\"><font color=\"#FFFFFF\">".$enr1["reponse"]."</font></td>";
echo"<td bgcolor=\"#3399CC\"><input type=\"checkbox\" name=\"choix[]\" ></td>";
echo"</tr>";
}
echo "</table>";
}
else
{echo "<p align=\'center\'><b>Aucun enregistrement</b></p>";}
?>
</td>
<tr>
<td align="center" colspan="2"><input type="submit" name="ajouter" value="ajouter"><input type="reset" name="Annuler" value="annuler"></td>
</tr>
<tr><td>
<?php
require_once("classes.php");
if (isset($_POST["ajouter"]) ) {
if(isset($_POST['choix'])){
foreach($_POST['choix'] as $id)
{$sq=new Serie_question(0,$_POST["num_q"],$_POST["id_categorie"],$_POST["contenu"],$_POST["image"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["reponse"]);
$res=$sq->ajouter();
if($res===true)
{echo'<script>alert("La série a été ajouter avec succes");window.history.go(-1);</script>';}
else
{echo($res);}
}
}
}
?> |
Partager