Plusieurs submit dans un formulaire
Salut!
Encore un problème!
voilà, j'ai un tableau alimenté par un select qui me montre le contenu d'une table:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| $req="SELECT * FROM missions";
$res=mysql_query($req);
$num=mysql_num_rows($res);
echo'<table border="2">';
echo'<tr><td colspan=7 align="center">FORMULAIRE CPA</td></tr>';
while($tab=mysql_fetch_array($res)){
echo'<form action="traitement_form_cpa.php" method="get">';
echo'<tr><td><input type="hidden" name="id_mission" value="'.$tab['id_mission'].'"</td>';
echo'<td><input type="hidden" name="id_page" value="'.$tab['idpage'].'"</td>';
echo'<td>'.$tab['destination'].'</td>';
echo'<td>'.$tab['titre_mission'].'</td>';
echo'<td>'.$tab['mission'].'</td>';
echo'<td><input type="submit" name="modifier" value="modifier"></td>';
echo'<td><input type="submit" name="supprimer"value="supprimer"></td>';
echo'</tr>';
}
echo'</form>';
echo'<tr><td colspan=7 align="center"><input type="button" value="Ajouter un enregistrement" onClick="location.replace(\'formulaire_cpa.php\')"</td></tr>';
echo'</table>'; |
J'ai donc 2 submits à chaque ligne, un pour modifier la ligne, l'autre pour la supprimer.
MAIS quand je passe au traitement:
Code:
1 2 3 4 5 6 7 8 9 10
| if($_GET['supprimer']){
$rq=("DELETE FROM missions where id_mission=".$_GET['id_mission']);
$requete=mysql_query($rq);
if($requete){
?>
<script type="text/javascript">
location.replace("affiche_table_cpa.php");
</script> |
$_GET ne correspond qu'à ma dernière ligne!!!:cry:
merci de votre aide
claire