chexkbox recuperation case
Bonjour,
J'ai deux fonctions. Dans la première je demande a l'utilisateur de cocher ce qu'il a besoin (les données viennent d'une base de données), puis je dois récupérer ces variables (les cases cochées) dans la deuxième page ! Comment faire ?
Code:
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
| function gpoint_recap_general(){
$requete="select * from gpoint_departement order by id_departement asc;";
$r=mysql_query($requete);
$nb=mysql_num_rows($r);
echo "<form name='formulaire'1' method='POST' action='modules.php?name=GPOINT&func=gpoint_recap_general_personne&i1=$i1'>";
echo "<div align='center'>";
echo "[<a href='modules.php?name=GPOINT'>RETOUR</a>]";
echo "<br /><br />";
echo "<table cellspacing='1' width='60%'>";
echo "<tr bgcolor='#B0C4DE' ALIGN='center' valign='middle' >";
echo "<td >";
echo "<h6>Lettre</h6>";
echo "</td>";
echo "<td>";
echo "<h6>Descriptif</h6>";
echo "</td>";
echo "<td>";
echo "<h6>Voir</h6>";
echo "</td>";
echo "</tr>";
for($i1=0;$i1<$nb;$i1++){
$lettre=mysql_result($r,$i1,"lettre_departement");
$descriptif=mysql_result($r,$i1,"descriptif_departement");
//$cp=datefr(mysql_result($r,$i,"cp"));
echo "<tr bgcolor='#DDDDDD' ALIGN='center'>";
echo "<td>";
echo "$lettre";
echo "</td>";
echo "<td>";
echo "$descriptif";
echo "</td>";
echo "<td>";
echo "<input type='checkbox' name='suite1[]' value=$i1>$i1";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<input type='submit' name='suite1' value='Suite'>";
echo "</div>";
echo "</form>";
} |
Et ma deuxième fonctions :
Code:
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 63 64 65 66 67 68 69
| function gpoint_recap_general_personne(){
$requete="select * from gpoint_personne;";
$r=mysql_query($requete);
$nb=mysql_num_rows($r);
echo "<form method='POST' action='modules.php?name=GPOINT&func=gpoint_choix_deux_dates'>";
echo "<div align='center'>";
echo "[<a href='modules.php?name=GPOINT'>RETOUR</a>]";
echo "<br /><br />";
echo "<table cellspacing='1' width='60%'>";
echo "<tr bgcolor='#B0C4DE' ALIGN='center' valign='middle'>";
echo "<td >";
echo "<h6>Nom</h6>";
echo "</td>";
echo "<td>";
echo "<h6>login</h6>";
echo "</td>";
echo "<td>";
echo "<h6>pass</h6>";
echo "</td>";
echo "<td>";
echo "<h6>Choix</h6>";
echo "</td>";
echo "</tr>";
for($i2=0;$i2<$nb;$i2++){
$nom=mysql_result($r,$i2,"nom");
$prenom=mysql_result($r,$i2,"prenom");
$adresse=mysql_result($r,$i2,"adresse");
echo "<tr bgcolor='#DDDDDD' ALIGN='center'>";
echo "<td>";
echo "$nom";
echo "</td>";
echo "<td>";
echo "$login";
echo "</td>";
echo "<td>";
echo "$pass";
echo "</td>";
echo "<td>";
echo "<input type='checkbox' name='suite2[]' value=$i2>$i2";
echo "</td>";
echo "</tr>";
}
echo "</table>";
// vérifions que la variable a été transmise
$tabLangages = (isset($_POST['suite1']))?$_POST['suite1']:null;
echo "voici :";
// bouclons sur le tableau qui a été transmis et affichons les valeurs sélectionnées
if (!empty($tabLangages)) {
foreach($tabLangages as $cle => $valeur) {
echo $cle.' : '.$valeur.'<br>';
}
}
echo "<input type='submit' name='suite1' value='Suite'>";
echo "</div>";
echo "</form>";
} |