Bonjour,
Mon application permet à l'utilisateur d'effectuer une recherche.
Cette recherche donne des résultats
Et pour chaque résultats on peut soit modifier soit supprimer le résultat associé puisqu'il y a deux boutons pour chaque résultat.
J'ai donc fait un formulaire pour chaque résultat et du coup il y a deux boutons différents pour un seul formulaire, sauf qu'évidemment ça ne doit pas avoir le même traitement.
Est ce vraiment possible et si non, quelle est l'autre solution ?
Merci !!
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 <?php // Connexion $lien=mysql_connect("localhost","root",""); mysql_select_db("complaint_applet",$lien); //Test connexion if ($lien==0) { printf("Error of connexion with the server"); } $CompName=$_POST['CompName']; $CompNb1 =$_POST['CompNb1']; $CompNb2 =$_POST['CompNb2']; $Date1=$_POST['date1']; $Date2=$_POST['date2']; $Natco=$_POST['natco']; $Los=$_POST['los']; $Status=$_POST['status']; $ProblemType=$_POST['problemType']; if( $CompName==null ) $CompName = '%'; if( $CompNb1 ==null) $CompNb1 = '%'; if( $CompNb2 == null) $CompNb2 = '%'; if( $Natco==null ) $Natco = '%'; if( $Los==null ) $Los = '%'; if( $Status==null ) $Status = '%'; if( $ProblemType==null ) $ProblemType = '%'; //Request $request="SELECT * FROM complaint WHERE Complainant_name LIKE '%$CompName%' AND Complaint_year LIKE '$CompNb1' AND Natco LIKE '$Natco' AND LOS LIKE '$Los' AND Status LIKE '$Status' AND 'Problem_type' LIKE '$ProblemType' AND Complaint_number LIKE '$CompNb2'"; if( $Date1 != null && $Date2 != null) { $request .= " AND Complaint_reception_date BETWEEN '$Date1' AND '$Date2'"; } $result=mysql_query($request); $nb=mysql_num_rows($result); if ($nb==null) { echo"No result corresponds to your research"; } else { $i=0; while($i<$nb) { $find=mysql_fetch_array($result); $NbComplaint=$find[0]; $Reception_date=$find[1]; $Recording_date=$find[2]; $Recording_time=$find[3]; $Recorded_by=$find[4]; $Description=$find[5]; $NbIncident=$find[6]; $Natco=$find[7]; $LOS=$find[8]; $Status=$find[9]; $LSCD=$find[10]; $LCD=$find[11]; $LCT=$find[12]; $LCB=$find[13]; $Complainant_name=$find[14]; $CPSD=$find[15]; $CPST=$find[16]; $R_comments=$find[17]; $Problem_type=$find[18]; $CA_P=$find[19]; $CA_D=$find[20]; $CD=$find[21]; $CT=$find[22]; $Del=$find[23]; $Complaint_year=$find[24]; $i++; echo" <table width=100%> <form method=post action=Modify.php> <tr> <td width=63%>Incident/Request number<b> $NbIncident </b>taken delivery of the <b>$Reception_date</b></td> <td></td> <td> <input type='hidden' name=NbComplaint value='$NbComplaint'> <input type='hidden' name=Complaint_year value='$Complaint_year'> <input type='hidden' name=Reception_date value='$Reception_date'> <input type='hidden' name=Recording_date value='$Recording_date'> <input type='hidden' name=Recording_time value='$Recording_time'> <input type='hidden' name=Recorded_by value='$Recorded_by'> <input type='hidden' name=Description value='$find[5]'> <input type='hidden' name=NbIncident value='$NbIncident'> <input type='hidden' name=Natco value='$Natco'> <input type='hidden' name=LOS value='$LOS'> <input type='hidden' name=Status value='$Status'> <input type='hidden' name=LSCD value='$LSCD'> <input type='hidden' name=LCD value='$LCD'> <input type='hidden' name=LCT value='$LCT'> <input type='hidden' name=LCB value='$LCB'> <input type='hidden' name=Complainant_name value='$Complainant_name'> <input type='hidden' name=CPSD value='$CPSD'> <input type='hidden' name=CPST value='$CPST'> <input type='hidden' name=R_comments value='$R_comments'> <input type='hidden' name=Problem_type value='$Problem_type'> <input type='hidden' name=CA_P value='$CA_P'> <input type='hidden' name=CA_D value='$CA_D'> <input type='hidden' name=CD value='$CD'> <input type='hidden' name=CT value='$CT'> <input type='hidden' name=Del value='$Del'> <input type=image src=img/modify.bmp> <input type=image src=img/delete.bmp></td> </tr> <tr> <td>Recorded to <b>$Recording_date</b> at <b>$Recording_time</b> as a complaint number <b>$Complaint_year- $NbComplaint</b></td></tr> <tr> <td>Complainant name : <b>$Complainant_name</b></td> <td width=20%>Natco : <b>$Natco</b></td> <td width=20%>LOS : <b>$LOS</b></td> </tr> </form> </table>"; $Desc=substr($Description,0,50); echo" <table style=table-layout:fixed> <tr> <td>Description : <b>$Desc</b> </td> </tr> </table>"; echo" <table width=100%> <tr> <td width=50%>Status : <b>$Status</b></td> <td width=50%> Problem type : <b>$Problem_type</b></td> </tr> </table>"; if ($CPSD=='0000-00-00') {$CPSD="This problem has been not solved";} else {$CPSD="Problem solved to $CPSD";} if ($CPST=='00:00:00') {$CPST="";} else {$CPST="at $CPST";} echo" <table> <tr> <td></td> </tr> <tr> <td><b>$CPSD $CPST</b></td> </tr> </table>"; ?> <HR width=100% size=4 color=darkblue> <? } } ?>
Partager