Bonjour
j'ai développé un diaporama avec un menu déroulant pour les dossiers des ranges pour sélectionner les hauteurs et largeurs de mes images. Un autre menu par lot de 50 images et c'est ça qui cloche
Ce qui nous intéresse ce trouve entre les lignes 223 et 262.
Le php exécute lot1 et lot3 jusqu'à la dèrmière ligne $lot1 = 51; $lot3 = $nbr_tof;.
Je voudrais donc qu'il s'arrète a la ligne 236
Code php : 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
<script> 
  document.cookie = "slidex = " + screen.width + "; SameSite=Strict";
  document.cookie = "slidey = " + screen.height + "; SameSite=Strict"; 
</script>
<!DOCTYPE html>
<html>
<head>
    <link href="css/grid.css" rel="stylesheet" type="text/css" />
    <link href="css/nbr-tof.css" rel="stylesheet" type="text/css" />
    <link href="css/range.css" rel="stylesheet" type="text/css" />
    <link href="css/custom.css" rel="stylesheet" type="text/css" />
    <link href="css/text.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor= "#FFF">
    <div class="block">
        <div style "border 1px solid #CA0000" class="wrapper">
            <div  class="boxcenter first"> <img src="pics/header.jpg" height="120" width="980">
        </div>
    <div style="width:250px; border: 1px solid #000000" class="one">
        <form method="GET" action="index3.php">
<?php
 
 session_start();
 
$pdo = new PDO('mysql:host=adresse; dbname=database', 'ID', 'pass');
$dos = $_GET['dos'];
 
    $hmin_get = $_GET['hmin'];
    $hmax_get = $_GET['hmax'];
    $wmin_get = $_GET['wmin'];
    $wmax_get = $_GET['wmax'];
 
    $sql_count = 'SELECT COUNT(name_tof) AS new_tof FROM pictures WHERE dos_tof = :dos_tof';
    $count_less = $pdo->prepare($sql_count); 
    $count_less->execute(array('dos_tof' => $dos)); 
    $count_tof = $count_less->fetch();
    $nbr_tof = $count_tof['new_tof']; 
 
    $mult = ceil($nbr_tof/50)-1;			
 
if (isset($_GET['reset'])) {
	if ($mult == 0) { 
		$lot1= 1; 
		$lot3 = $nbr_tof;
    } 
	if ( $mult >=1 ) {
		$lot1 = 1;
		$lot3 = 50;
	}
}
 
?>	   
 
<ul   id="menu-accordeon">
    <li style="width: 250px"><a href="#">Categories</a>
       <ul style="width: 250px; z-index: 1000;">
<?php
 
	if ($mult == 0) { 
		$lot1= 1; 
		$lot3 = $nbr_tof;
    } if ( $mult >=1 ) {
		$lot1 = 1;
		$lot3 = 50;
	}	
 
	$dir = 'pictures/';
    $fil_dir = scandir($dir);
    $nbr_dir = count($fil_dir);
    $nbr_dir = $nbr_dir-1;
 
        for ($t=2; $t<=$nbr_dir; $t++) {
            $str = $fil_dir[$t];
            $order = '_';
            $replace = ' ';
            $fil_com[$t] = str_replace($order, $replace, $str);
 
            echo '<li><a href="index3.php?dos='.$fil_dir[$t].'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&pics=De_'.$lot1.'_à_'.$lot3.'&tem=1">'.$fil_com[$t].'</a></li>';
 
 
	    }
 
            echo '<input id="dos" name="dos" type="hidden" value="'.$dos.'">';
 
?>	 
	 </ul>
   </li>
</ul>
 
<?php
 
    $dir_pics  = $dos;
    $less = "_";
    $dir_done   = " ";
    $dos_one = str_replace($less, $dir_done, $dos);
 
	echo '<span class="vio"><br><br>'.$dos_one.'</span>';	
?>
 
    </div>
 
<?php
 
    $sql_done = 'SELECT min(height), max(height), min(width), max(width), name_tof, dos_tof FROM pictures WHERE dos_tof = :dos_tof';
    $sth_less = $pdo->prepare($sql_done); 
    $sth_less->execute(array('dos_tof' => $dos)); 
    $done_pics = $sth_less->fetch();
    $nbr_tof = $sth_less -> rowCount();
 
    $heightmin = $done_pics['min(height)'];
    $heightmax  = $done_pics['max(height)'];
    $widthmin = $done_pics['min(width)'];
    $widthmax = $done_pics['max(width)'];	 
 
    if (isset($_GET['reset'])) {
        $heightmin = $done_pics['min(height)'];
        $heightmax  = $done_pics['max(height)'];
        $widthmin = $done_pics['min(width)'];
        $widthmax = $done_pics['max(width)'];	 
 
 	}
 
?>
	<div style="border: 1px solid #000000"  class="boxcenter two"> 
    	<span class="gris9">hauteur comprise entre
        <input type="range" class="custom-slider custom-slider-bullet" name="hmin" id="hmin"
	    value="<?php 	if (isset($_GET['reset'])) { echo $heightmin; } else { echo $hmin_get; }; ?>"
	    min="<?php echo $heightmin ?>"
	    max="<?php echo $heightmax ?>" 
	    oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo  $hmin_get ?>
		</output><br>
 
        et<br>
 
	    <input type="range"  class="custom-slider custom-slider-bullet" name="hmax" id="hmax" 
	    value="<?php	if (isset($_GET['reset'])) { echo $heightmax; } else { echo $hmax_get; }; ?>"
	    min="<?php echo $heightmin; ?>"
	    max="<?php echo $heightmax; ?>" 
	    oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo $hmax_get  ?>
	    </output>
        </span>
    </div>
    <div style "border: 1px solid #000000" class="boxcenter three"> 
 
	    <span class="gris9">largeur comprise entre
        <input type="range"  class="custom-slider custom-slider-bullet" name="wmin"id="wmin" 
	    value="<?php 	if (isset($_GET['reset'])) { echo $widthmin; } else { echo $wmin_get; }; ?>"
	    min="<?php echo $widthmin  ?>"
	    max="<?php echo $widthmax ?>"
	    oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo $wmin_get ?>
	    </output><br>
 
	    et<br>
 
	    <input type="range"  class="custom-slider custom-slider-bullet" name="wmax"id="wmax" 
	    value="<?php	if (isset($_GET['reset'])) { echo $widthmax; } else { echo $wmax_get; }; ?>"
    	min="<?php echo $widthmin  ?>"
	    max="<?php echo $widthmax ?>"
    	oninput="this.nextElementSibling.textContent = this.value"/>
        <output><?php echo $wmax_get ?>
	    </output>  </span>
 
    </div>
    <div style="width: 200px" class="boxthree four"><div>
        <input style="width: 90px; height: 30px; font-size: 15px;" type="submit" name="val" value="Valider" />
        <input style="width: 90px; height: 30px; font-size: 15px;" type="submit" name="reset" value="reset" />
 
 
	</div>
	<div>		
 
<?php
 
    $sql_calc = 'SELECT height, width, name_tof, dos_tof FROM pictures WHERE dos_tof = :dos_tof AND height <= :hmax_get AND height >= :hmin_get AND width >= :wmin_get AND width <= :wmax_get';
    $sth_calc = $pdo->prepare($sql_calc); 
    $sth_calc->execute(array('dos_tof' => $dos,
                         'hmax_get' => $hmax_get,
						 'hmin_get' =>$hmin_get,
						 'wmax_get' => $wmax_get,
						 'wmin_get' => $wmin_get
						 )); 
    $done_calc = $sth_calc->fetchAll();
    $nbr_tof = $sth_calc -> rowCount();
 
?>
    </div>
	<div>
 
<?php
 
    echo "<br><span class='gris9'>".$nbr_tof." photos dans la base</span>";
 
    $mult = ceil($nbr_tof/50)-1;
        echo $mult;
 
   	    if ($mult==0) {
 
            if (isset($_GET['reset'])) {
 
        	   $lot1 = 1;
               $lot3 = $nbr_tof;
 
     	    }  
 
            $lot1 = 1;
	     $lot3 = $nbr_tof;
 
?>
    <ul   id="menu-accordeon">
        <li style="width: 200px;"><span class="vio"><a href="#">De_<?php echo $lot1; ?>_à_<?php echo $lot3; ?></a></span>
            <ul style="width: 200px; z-index: 1000;">
            </ul>
	    </li>
    </ul>
 
<?php
 
        }
 
<====================================>
 
 
if ($mult==1) {
 
    if (isset($_GET['reset'])) {
 
     $lot1 = 1;
     $lot3 = 50;
 
	}
 
    $lot1 = 1;              <==================
    $lot3 = 50;       <================
 
?>
 
    <ul   id="menu-accordeon">
        <li style="width: 200px;"><span class="vio"><a href="#">De_<?php echo $lot1; ?>_à_<?php echo $lot3; ?></a></span>
           <ul style="width: 200px; z-index: 1000;">
<?php
	echo '<li><a href="index3.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
        if (isset($_GET['val'])) {
	        $lot1 = 51;                 <===============
            $lot3 = $nbr_tof;      <===============
        }
 
	echo '<li><a href="index3.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
 
?>  
 
        </ul>
    </li>
</ul>
 
<?php 
 
    }
 
<==============================================>
 
 
?>
    	</div>
	</div>
<div class="five">
 
<?php
 
$l = 1;
$m = 1;
 
global $data;
 
$l = 1;
foreach ($done_calc as $done_file) {
    $data[$l]['dim'] = array($done_file['height'],  $done_file['width']);
    $data[$l]['dos'] = $dos;
    $data[$l]['name_tof'] = $done_file['name_tof'];
    $data[$l]['lot'] = array($lot1, $lot3);
    $data[$l]['nbr_tof'] = $nbr_tof;
    $data[$l]['select'] = $l;
 
$l++;
 
   }	
 
$_SESSION['data'] = $data;
 
echo $lot1.' '.$lot3;
 
for($i=$lot1; $i<=$lot3; $i++) {
 
    $_SESSION['data' ][$i]['lot'][0] = $lot1;
    $_SESSION['data'][$i]['lot'][1] = $lot3;
 
    echo $_SESSION['data'][$i]['name_tof'].' '.$_SESSION['data'][$i]['dos'].' '.$_SESSION['data'][$i]['select'].'<br>';
 
	}
 
 
echo '<a href="/test/transmit.php">transmit</a>'
 
?>
               </div>
           </form>
        </div>  
    </div>
</body>
</html>
Comment faire ??