recuperation des valeurs de zone de text dans datagrid
bonsoir à tous ,
s'il vous plait je suis un débutant en php et je souhaite faire un datagrid
,elle m'affiche des enregistrements avec pour chaque ligne la possibilité de modifier et supprimer ,bref en cliquant sur modifier j'ai un lien enregistrer qui s'affiche et qui enregistre les valeurs des zones de text .
mon probleme c'est que j'arrive pas à récupérer la valeur des zones de texte !
merci de faire de votre mieux pour m'aider .
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
<? session_start();
require_once('Connexion.php');
$dbase="ONE";
$cn=new Connexion();
$cn->Connect($dbase);
if( isset($_GET['supprimer']) ){
$id=$_GET['supprimer'];
$req="DELETE FROM tb_abonnement WHERE Num_ab='".$id."' ";
$resp=mysql_query($req);
}elseif(isset($_GET['enregistrer'])){
if(isset($_POST['nom_ab']))
{
echo "XXXXXXXXXXXXXX ".$_POST['nom_ab'];
}else{
echo "0000" ;
}
//je n'ai pas pu récuperé les valeurs des zones de texte pour la modif
/*
$id=$_GET['enregistrer'];
$req="UPDATE tb_abonnement set Nom_ab='".$_POST['nom_ab']."' ,Prenom_ab='".$_POST['prenom_ab']."' ,Adresse_ab='".$_POST['adresse_ab']."' WHERE Num_ab='".$id."' ";
$xx=mysql_query($req);
*/
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>
<body>
<form name="frm" action="" method="post">
<table width="751" border="1" cellspacing="2" align="center">
<tr>
<th width="115" scope="col">Nom</th>
<th width="142" scope="col">Prénom</th>
<th width="238" scope="col">Adresse</th>
<th width="106" scope="col">Modification</th>
<th width="116" scope="col">Suppression</th>
</tr>
<?
$requete="SELECT * FROM tb_abonnement";
$response=mysql_query($requete);
$x="txt";
$y=0;
while($rep=mysql_fetch_array($response)) { extract($rep);?>
<? if(isset($_GET['modifier'])) {
if($_GET['modifier']==$Num_ab){ ; ?>
<tr>
<td><input type='text' name='nom_ab' value='<? echo $Nom_ab ?>' /> </td>
<td><? echo "<input type='text' name='nom_ab' value='$Prenom_ab'/>";?> </td>
<td><? echo "<input type='text' name='adresse_ab' value='$Adresse_ab' />"; ?> </td>
<td><? echo "<a href='datagrid.php?enregistrer=$Num_ab'>Enregistrer</a>"; ?></td>
<td><? echo "<a href='datagrid.php?supprimer=$Num_ab'>Supprimer</a>"; ?></td>
</tr>
<?
}// fin if $_GET['modifier']==$Num_ab)
else { ?>
<tr>
<td><? echo $Nom_ab ?> </td>
<td><? echo $Prenom_ab?> </td>
<td><? echo $Adresse_ab?> </td>
<td><? echo "<a href='datagrid.php?modifier=$Num_ab'>Modifier</a>"; ?></td>
<td><? echo "<a href='datagrid.php?supprimer=$Num_ab'>Supprimer</a>"; ?></td>
</tr>
<? }
}// fin if $_GET['modifier']
else {?>
<tr>
<td><? echo $Nom_ab ?> </td>
<td><? echo $Prenom_ab?> </td>
<td><? echo $Adresse_ab?> </td>
<td><? echo "<a href='datagrid.php?modifier=$Num_ab'>Modifier</a>"; ?></td>
<td><? echo "<a href='datagrid.php?supprimer=$Num_ab'>Supprimer</a>"; ?></td>
</tr>
<? } //fin else $_GET['modifier']
} //fin while?>
</table>
</form>
</body>
</html> |