Bonjour à tous,

Je viens vers vous car j'ai un petit problème sur un formulaire.

J'ai un formulaire qui me permet de récuperer des données depuis une base dedonnée mais je voudrais pouvoir les afficher ainsi que les modifier en direct depuis le formulaire.

Et je suis perdu, perdu, perdu, perdu....

Je vous joint mon code en esperant que vous pourrez m'aider.

Merci d'avance.

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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="fr"><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>Recherche des données</title>
<style type="text/css">#Gauche {
float: left;
font-family: "Times New Roman",Times,serif;
font-weight: bold;
text-align: left;
color: black;
font-style: normal;
width: 5%;
margin-left:10px;
}
#center {
border-style: solid;
border-width: 1px;
background-color: #E8E8E8;
float: left;
font-family: "Times New Roman",Times,serif;
font-weight: bold;
color: black;
font-style: normal;
width: 80%;
margin-left: 7px;
margin-right:7px;
padding:10px;
}
#Droit {
float: left;
font-family: "Times New Roman",Times,serif;
font-weight: bold;
text-align: left;
color: black;
font-style: normal;
width: 5%;
padding: 5px;
}
</style></head>
 
<body style="color: rgb(0, 0, 0); background-color: rgb(153, 255, 255); background-image: url(images/fond.gif);" alink="#000099" link="#000099" vlink="#990099">
<div style="text-align: center;"><img style="width: 150px; height: 118px;" alt="Logo Interval" src="l_interval.gif"><br>
<center style="color: red;"><h1 style="background-color: rgb(153, 255, 153);">Recherche données gicasa</h1></center>
 
<div id="Gauche"></div>
<div id="center">
<!-- Mise en place du formulaire de recherche -->
 
<form method="post">
 
<p>Rechercher par :</p><br/>
 
Date: <input type="text" name="date" /> -
 
Demandeur : <input type="text" name="Demandeur" /> -
 
Descriptif : <input type="text" name="Descriptif" /> -
 
Contact : <input type="text" name="Contact" /> -
 
Date des contacts : <input type="text" name="date_contact" />
 
Solution : <input type="text" name="solution" /> -
 
Prov/Déf : <input type="text" name="pd" /> -
 
Test - Qui et Ou : <input type="text" name="test_qui_ou" /> -
 
Test - Quand : <input type="text" name="test_quand" /> -
 
Test - Ok/Non : <input type="text" name="test_ok" /> -
 
<br/><input type="submit" value="Chercher" />
 
</form>
 
<center><table width="981" border="1" cellspacing="0" cellpadding="0">
 
  <tr>
 
    <td width="62"><div align="center">Date</div></td>
 
    <td width="62"><div align="center">Demandeur</div></td>
 
    <td width="71"><div align="center">Descriptif</div></td>
 
    <td width="73"><div align="center">Contact</div></td>
 
    <td width="80"><div align="center">Date des contacts</div></td>
 
    <td width="86"><div align="center">Solution</div></td>
 
    <td width="86"><div align="center">Prov/Déf</div></td>	
 
    <td width="86"><div align="center">Test - Qui et Ou</div></td>
 
    <td width="86"><div align="center">Test - Quand</div></td>
 
    <td width="86"><div align="center">Test - Ok/Non</div></td>
 
 </tr>
 
<?php
 
//récupération des variables
 
$date=$_POST['date'];
 
$demandeur=$_POST['demandeur'];
 
$descriptif = $_POST['descriptif'];
 
$contact=$_POST['contact'];
 
$date_contact=$_POST['date_contact'];
 
$solution = $_POST['solution'];
 
$pd=$_POST['pd'];
 
$test_qui_ou=$_POST['test_qui_ou'];
 
$test_quand=$_POST['test_quand'];
 
$test_ok=$_POST['test_ok'];
 
 
//Requêtes
 
mysql_connect("localhost", "root", "") or die ("Pas de connexion à la base de données"); // Connexion à MySQL
 
mysql_select_db("Entretien") or die ("Pas de connexion à la base"); // Sélection de la base Entretienphp
 
// Si au moins un champs est remplit
 
if ((!empty($date)) or (!empty($demandeur)) or (!empty($descriptif)) or (!empty($contact)) or (!empty($date_contact)) or (!empty($solution)) or (!empty($pd)) or (!empty($test_qui_ou)) or (!empty($test_quand)) or (!empty($test_ok)))
 
{
 
 $reponse = mysql_query("SELECT * FROM gicasa WHERE (`date`='$date')  or WHERE (`demandeur`='$demandeur') or WHERE (`descriptif` LIKE '%$descriptif%') or WHERE (`contact`='$contact') or WHERE (`date_contact`= '$date_contact') or WHERE (`solution` LIKE '%$solution%') or WHERE (`pd`= '$pd') or WHERE (`test_qui_ou`='$test_qui_ou') or WHERE (`test_quand`='$test_quand') or WHERE (`test_ok`='$test_ok')"); // Requête SQL
 echo $reponse;
}
 
 
// On fait une boucle pour lister tout ce que contient la table :
//***********************************************************************************************************************
if ($reponse)
{
//*************************************************************************************************************************
while ($donnees = mysql_fetch_array($reponse))
 
{
 
?>
 
  <tr>
 
    <td><center><strong><?php echo $donnees['date']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['demandeur']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['descriptif']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['contact']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['date_contact']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['solution']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['test_qui_ou']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['test_quand']; ?></strong></center></td>
 
    <td><center><strong><?php echo $donnees['test_ok']; ?></strong></center></td>
 
   </tr>
 
<?php
 
}
 
 
 
//mysql_close(); // Déconnexion de MySQL
//****************************************************************************************************
}
else
{
echo 'Veuillez remplir au moins un champs !!!';
}
//****************************************************************************************************
?>
 
</table></center>
<br/><br/>
<a href="index.html"><big>Retour à la page d'index</big></a><br>
</div><div id="Droit"></div>
</body></html>
Amicalement
Steph70