Bonjour,

J'ai trouvé sur ce merveilleux forum un code en JS qui permet d'agrandir un div en cliquant sur un div titre.

Cf. post Ouverture/Fermeture progressive d'un div (par agrandissement)

En fait je l'ai appliqué sur mon application, elle fonctionne très bien sauf que ce n'est que pour mon premier résultats.

Enfait ce principe est intégré dans ma recherche. Comme pour chaque résultats il y a de nombreuses caractéristiques, on affiche au premier chargement que les caractéristiques principales, puis grâce à ce principe, en cliquant sur une icone on peut développer la page cachée et ainsi voir les caractéristiques secondaires. Sauf que ça fonctionne pour mon premier résultat, mais pas pour les suivants. J'ai pourtant intégré le principe dans le while.

Voilà mon code :

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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
 
<script type='text/javascript'>
 
var y = 1;
var step = 5;
var down = true;
var minstep=step;
var running=false;
var t
 
 
function smooth_on_off(p_id, hmax){
  running=true;
  obj=document.getElementById(p_id);
 
  if(y>hmax&&down){step=-step;
                down=false;
                running=false;
                clearInterval(t);
                return false;}
  if(y<minstep&&!down){step=-step;
                down=true;
                running=false;
                y=1;
                clearInterval(t);
                return false;}
 
  y = y+step;
 
  obj.style.height = y + 'px';
}
 
function deroule(p_id,hmax){
if (running) {return false;}
t=setInterval(function(){smooth_on_off(p_id,hmax)},1)
 
}
</script>
<?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");
}
 
 
if (!isset($_POST['submit']))
{
	//Recovery of all the variables seized in the form of search
	$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($Date1!=null)
	{
		//Shaping of "Date1" date
		$DateD=$Date1[0].$Date1[1];
		$DateM=$Date1[3].$Date1[4];
		$DateY=$Date1[6].$Date1[7].$Date1[8].$Date1[9];
		$Date1=$DateY.'-'.$DateM.'-'.$DateD;
		echo"<br>";
	}
	if($Date2!=null)
	{
		//Shaping of "Date2" date
		$DateD=$Date2[0].$Date2[1];
		$DateM=$Date2[3].$Date2[4];
		$DateY=$Date2[6].$Date2[7].$Date2[8].$Date2[9];
		$Date2=$DateY.'-'.$DateM.'-'.$DateD;
	}
 
	//Shaping for a simpler query
	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 of search
	$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 the dates are seized, the query is completed
		if( $Date1 != null && $Date2 != null)
		{
			$request .= " AND Complaint_reception_date BETWEEN '$Date1' AND '$Date2'";
		}		
		$request.="ORDER BY Del";
 
		//Query execution
		$result=mysql_query($request);
 
		//Recovery of results number to traverse them in order to display them
		$nb=mysql_num_rows($result);
 
		//If there is no result correspond to the search criterias
		if ($nb==null)
		{
			echo"No result corresponds to your research";
		}
		//If there are results
		else
		{
			//Loop to recover all the query results lines
			$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++;
 
				//Results display
				?>				
				<form action="./Result.php" name="viewcart" id="viewcart" method="post">
				<input type="hidden" name="fuseaction" id="fuseaction" value="default" />
					<table width=100%>
						<tr>
							<td width=63%>Incident/Request number<b> <?php echo"$NbIncident"; ?> </b>taken delivery of the <b> <?php echo"$Reception_date"; ?> </b></td>
							<td></td>
							<td>
 
 
							<?
							//If the complaint is "removed", the search must display it at the result end
							if ($Del==0)
							{
 
								echo"<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='$Description'>
								<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="submit" class="boutonImageD" name="submit" value="    " onClick="document.getElementById('fuseaction').value = 'delete';" />
								<input type="submit" class="boutonImageM" name="submit" value="     " onClick="document.getElementById('fuseaction').value = 'modify';" />
 
								<?
							}
							$Desc=substr($Description,0,50);
							?>
						</tr>
						<tr>
							<td>Recorded to <b><?php echo"$Recording_date"; ?></b> at <b><?php echo"$Recording_time"; ?></b> as a complaint number <b><?php echo"$Complaint_year- $NbComplaint"; ?></b></td>
						</tr>
						<tr>
							<td>Complainant name : <b><?php echo"$Complainant_name"; ?></b></td>
							<td width=20%>Natco : <b><?php echo"$Natco"; ?></b></td>
							<td width=20%>Origin : <b><?php echo"$LOS"; ?></b></td>
						</tr>
					</table>
					<table style=table-layout:fixed>
						<tr>
							<td>Description : <b><?php echo"$Desc"; ?></b> </td>
						</tr>
					</table>
					<table width=100%>
						<tr>
							<td width=50%>Status : <b><?php echo"$Status"; ?></b></td>
							<?php
							if ("$Problem_type"==null)
							{
								echo"";
							}
							else
							{
								?><td width=50%> Problem type : <b><?php echo"$Problem_type"; ?></b></td><?php
                                                        }
                                                        ?>							
						</tr>
					</table>
 
 
					<?
					//Shaping of Complainant problem solving date & time
					if ($CPSD=='0000-00-00')
						{$CPSD="This problem has not been solved";}
					else
						{$CPSD="Problem solved to $CPSD";}
 
					if ($CPST=='00:00:00')
						{$CPST="";}
					else
						{$CPST="at $CPST";}
					?>
					<table>
						<tr>
							<td></td>
						</tr>
						<tr>
							<td><b><?php echo"$CPSD $CPST"; ?></b></td>
						</tr>
					</table>	
					<body onload="document.getElementById('command').focus()">
						<div class="main">
 
 
							<div id="flop" class="content">
								<table>
									<tr>
										<td>All the description : <b><?php echo"$Description"; ?></b></td>
									</tr>
									<tr><?php
										if("$LSCD"=="0000-00-00")
										{
											echo"";
										}
										else
										{
											?><td>Last status modification date : <b><?php echo"$LSCD"; ?></b></td><?php
                                                                                }?>
									</tr>
									<tr><?php
										if("$CA_P"==null)
										{
											echo"";
										}
										else
										{
											?><td> Corrective action planned : <b><?php echo"$CA_P"; ?></b></td><?php
                                                                                }?>
									</tr>
									<tr><?php
										if("$CA_D"==null)
										{
											echo"";
										}
										else
										{
											?><td> Corrective action done : <b><?php echo"$CA_D"; ?></b></td><?php
                                                                                }?>
									</tr>
									<tr>
										<td> This complaint has been recorded by : <b><?php echo"$Recorded_by"; ?></b></td>
									</tr>
									<tr>
										<td>Last change carried out the <b><?php echo"$LCD";?></b> at <b><?php echo"$LCT";?></b> by <b><?php echo"$LCB";?></b></td>
									</tr>
									<tr><?php
										if("$CD"=="0000-00-00")
										{
											echo"";
										}
										else
										{
											?><td>Complaint closed to <b><?php echo"$CD";?></b> at <b><?php echo"$CT";?></b></td><?php
                                                                                }?>
									</tr>
									<tr>
										<td></td>
									</tr>
 
								</table>
								<table>
									<tr><?php
										if("$R_comments"==null)
										{
											echo"";
										}
										else
										{
											?><td>Resolution comments : <b><?php echo"$R_comments";?></b></td><?php
                                                                                }?>
									</tr>			
								</table>
							</div>
							<div class="title" onclick="deroule('flop', 200);" id='command'>
								<img src="img/dev.bmp">
							</div>
						</div>
					</body>
				</form>
				<?php
                        }
                }
}               
 
//If the form were already "submited"           
if(isset($_POST['submit']))
{
        if ($_POST['submit']=="    ")
        {
                include"Delete.php";
        }
        else if ($_POST['submit']=="     ")
        {
                include"Modify.php";
        }
        else
        {
                echo"Ca ne fonctionne pas";
        }
}
 
?>
merci d'avance