salut les amis,
j'ai un problème depuis quelque jours, je suis bloqué d'être trouver une solution , comme je n'ai trouver aucune personne qui peux m'aider et me donner une simple solution avec une explication bien claire.
voilà mon projet (j'ai donné ici un petit exemple):
j'ai une base de donnée appelée: Personnelle, elle contient une table appelée:Identification contient deux champs, un champ pour le Nom et l'autre pour Prénom.
j'ai crée des formulaire (html) pour ajouter des Noms et Prénoms à la base de donnée. j'ai crée aussi un formulaire pour la recherche.
si je veux chercher une personne qui est enregistré dans ma base de donnée, je dois saisir son nom dans ce tableau et je clique sur ok:
et voilà les codes de cette partie:
code html:
et voilà le code php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <html> <head> <meta http-equiv="Content-Language" content="fr"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Nouvelle page 1</title> <!--mstheme--><link rel="stylesheet" href="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/FrontPageTempDir/mstheme/sweets/swee1111.css"> <meta name="Microsoft Theme" content="sweets 1111, default"> </head> <body> <form method="post" name="formulaire" action="recherche.php"> <p align="center"><u><b>recherche</b></u></p> <div align="center"> <center> <table border="1" cellspacing="1" width="27%"> <tr> <td width="50%">Saisir le Nom</td> <td width="50%">:<input type="text" name="Nom" size="13"></td> </tr> <tr> <td width="50%"> </td> <td width="50%"> <input type="submit" value="OK" name="B3"></td> </tr> </table> </center> </div> </body> </html>
maintenant je veux modifier les données de la résultat en cliquent sur le bouton Modifier:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 <?php $nom=$_POST['Nom']; $connexion = mysql_connect("localhost","root",""); $base = mysql_select_db("Personnelle"); $varid= htmlspecialchars($_POST['Nom'],ENT_QUOTES); $sql = mysql_query('SELECT * FROM Identification WHERE Nom="'.$varid.'"'); ?> <center><table BORDER=7 BGCOLOR="#E431EB" WIDTH="50%" HEIGHT="10%"> <?php while($result = mysql_fetch_array($sql))//le lancement de la boucle { ?> <tr><td BGCOLOR="#B5E197" scope="row"><B>Nom</B></td><td BGCOLOR="#B5E197" scope="row"><?php echo $result ['Nom'] ?></td> </tr> <tr><td BGCOLOR="#FEAB74"scope="col"><B>Prénom</B></td><td BGCOLOR="#FEAB74"scope="row"><?php echo $result ['Prénom'] ?></td> </tr> <?php } ?> </table> <form method="POST" action="modifier.php"> <input type="submit" value="Modifier" name="Modifier"> </form></center>
et quant je clique sur le bouton Modifier le Tableau suivant apparaitre:
et voilà le code php pour exécuter la modification:
le problème est:comment récupérer les données de deuxième colonne(le Nom et prénom)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <?php $nom=$_POST['Nom']; $connexion = mysql_connect("localhost","root",""); $base = mysql_select_db("Personnelle"); $sql = mysql_query('UPDATE Identification SET Prénom="hzika" WHERE nom="Almakki";'); ?> <center><table BORDER=7 BGCOLOR="#E431EB" WIDTH="50%" HEIGHT="10%"> <tr><td BGCOLOR="#B5E197" scope="row"><B>Nom</B></td><td BGCOLOR="#B5E197" scope="row"><?php echo ?></td> </tr> <tr><td BGCOLOR="#FEAB74"scope="col"><B>Prénom</B></td><td BGCOLOR="#FEAB74"scope="row"><?php echo ?></td> </tr> </table> <form method="POST" action="--WEBBOT-SELF--"> <input type="submit" value="Enregistrer" name="B1"></p> </form> </center>
je sais qu'il faux ajouter quelque chose après "echo" dans le tableau de résultat:
mais j'ignore la quelle??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <tr><td BGCOLOR="#B5E197" scope="row"><B>Nom</B></td><td BGCOLOR="#B5E197" scope="row"><?php echo ?></td> </tr> <tr><td BGCOLOR="#FEAB74"scope="col"><B>Prénom</B></td><td BGCOLOR="#FEAB74"scope="row"><?php echo ?></td> </tr>
aidez moi svp, je suis très intéressant![]()
Partager