Se connecter avec
S'enregistrer | Connectez-vous
Fermé

remplissage de la table serie_question après un choix de quelques case à cocher avec php5 et voici mon code

<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"])&& isset($_POST["choix"]) ) {
foreach($_POST["choix"] as $choix)
{$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);}
}}
?>

</td></tr>
</table>
</form>
</fieldset>
  • zeb a fermé ce sujet
Posez votre question