Merci pour la reponse, c'est en effet ce que j avais trouve.
Code :
- $n= 0;
- $colordied="#FF0000";
- echo "<FORM name='diedform' action='update_died.php' method='get'>
- <table border=0> <caption>Results</caption><tr><th>number</th><th>genotype</th>
- <th>Category</th><th>Died</th><th>Undied</th></tr>";
- while ($requete = mysql_fetch_array($resultat)) {
- $number=$requete["Number"];
- $gen=$requete["Genotype"];
- $cat=$requete["Category"];
- $died=$requete["died"];
- $idx=$requete["idx"];
- if ($died ==1) {
- echo "<tr><td bgcolor=\"$colordied\"><a href='details2.php?fly_number=".$number."' target='page1'>"
- .$number."</a><br></td><td bgcolor=\"$colordied\">$gen</td><td bgcolor=\"$colordied\">$cat</td><td bgcolor=\"$colordied\"></td>
- <td bgcolor=\"$colordied\"><input type='checkbox' name='undied[]' value='".$idx."'></td></tr>";}
- else {echo "<tr><td><a href='details2.php?fly_number=".$number."' target='page1'>"
- .$number."</a><br></td><td>$gen</td><td>$cat</td><td> <input type='checkbox' name='died[]' value='".$idx."'></td>
- <td></td></tr>";}
- $n++;
- }
- echo "<tr><td></td></td><td></td><td></td><td colspan=2> <input type='submit' name='Kill' value='Kill and Unkill flies'></td>
- </tr>";
- echo"</table>";
|
Maintenant je suis en train d'inclure dans la page de reponse l'update de la bdd, mais je bloue pour le moment a cause de la boucle foreach
Code :
- if(isset($_GET['died'] )){
- foreach ($_GET ['died']AS $diedidx =>$value)
- $requetekill= "UPDATE `fly_db`.`flydbtest2` SET `died` = '1' WHERE `flydbtest2`.`idx` ='$value'";
- mysql_query($requetekill) ;
- echo 'flie number ',$diedidx,'has been killed','<br />',$requetekill, "\n";
|
Forcement il n' y a que la derniere valeure qui est prise en compte.
Je ne sais pas si la meilleur facon est de creer differentes requete (nom de variable dynamique) ou encore de pouvoir tout injecter d un coup ...
Je suis en train de me documenter.
---------------
PSN : Luluberlu