IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

HTML Discussion :

formulaire $_GET submit url


Sujet :

HTML

  1. #1
    Membre confirmé Avatar de zool.bzh
    Homme Profil pro
    peintre industriel
    Inscrit en
    Octobre 2023
    Messages
    150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Côtes d'Armor (Bretagne)

    Informations professionnelles :
    Activité : peintre industriel
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2023
    Messages : 150
    Par défaut formulaire $_GET submit url
    Bonjour

    voici mon url:

    rama.php?dos=Dossier_1&hmax=1200&hmin=600&wmin=400&wmax=800&pics=De_1_à_50

    lorsque je clique sur mon bouton submit 'valider' ça me donne l'url là :

    rama.php?dos=Dossier_4&hmin=600&hmax=1200&wmin=400&wmax=800&val=Valider

    ma page -> oOo

    le &pics=De_1_à_50 est remplacer par &val=Valider

    je veux avoir les deux ensemble

    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
    <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 style="width:250px; border: 1px solid #000000" class="one">
            <form method="GET" action="rama.php">
    <?php
     
     session_start();
     
    $pdo = new PDO('mysql:host=IP;dbname=DB', 'ID', '****');
     
    $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 demo 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['pics'])) {
        $values = explode("_", $_GET['pics']);
            $lot1 = $values[1];
            $lot3 = $values[3];
    }
    if (isset($_GET['reset'])) {
            if ($mult == 0) { 
                    $lot1= 1; 
                    $lot3 = $nbr_tof;
    } 
    if ($mult >= 1) { 
                    $lot1= 1; 
                    $lot3 = 50;
    }  
    }
    if (!isset($_GET['pics'])) {
                    if ($mult == 0) { 
                    $lot1= 1; 
                    $lot3 = $nbr_tof;
    } 
    if ($mult == 1) { 
                    $lot1= 1; 
                    $lot3 = 50;
    }
    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
     
     
     
            $dir = 'tofs/';
        $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="rama.php?dos='.$fil_dir[$t].'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&pics=De_'.$lot1.'_à_'.$lot3.'">'.$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 demo 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 demo 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>";
        echo " ".$mult;
    if ($mult==0) {
            $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;">
    <?php
    if ($mult == 0) {
            $lot1 = 1;
            $lot3 = $nbr_tof;
    }
     
    if ($mult==1 && $lot3<=$nbr_tof) {
            $lot1 = 51;
            $lot3 = $nbr_tof;
            
    echo '<li><a href="rama.php?dos='.$dos.'&hmax='.$hmax_get.'&hmin='.$hmin_get.'&wmin='.$wmin_get.'&wmax='.$wmax_get.'&pics=De_'.$lot1.'_à_'.$lot3.'">De_'.$lot1.'_à_'.$lot3.'</a></li>';
    }
    $t="";
    if ($mult>1) {
                    for ($t=1; $t<=$mult; $t++) {
    $lot3 = $t*50;
    $lot1 = $lot3-49;
    echo '<li><a href="rama.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 ($mult>1) {
            $lot3 = $nbr_tof;
            $lot1 = ($t*50)-49;
            echo '<li><a href="rama.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;
     if (isset($_GET['pics'])) {
        $values = explode("_", $_GET['pics']);
            $lot1 = $values[1];
            $lot3 = $values[3];
    }
    $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;
            
      
         
    if ($mult==0) {
            $lot1 = 1;
            $lot3 = $nbr_tof;
    }
    echo $lot1.' '.$lot3."<br>";
    for($i=$lot1; $i<=$lot3; $i++) {
     
    $_SESSION['data' ][$i]['lot'][0] = $lot1;
    $_SESSION['data'][$i]['lot'][1] = $lot3;
    //echo $data[$i]['name_tof'];
      echo $_SESSION['data'][$i]['select'].' '.$_SESSION['data'][$i]['name_tof'].' '.$_SESSION['data'][$i]['dos'].'<br>';
    }
     
     
    //echo '<a href="/test/transmit.php">transmit</a>'
    //print_r($_SESSION['data'][1]['lot'][0]);
     
    ?>
    </div>
    </form>
     </div>  
     </div>
     
    </body>
    </html>
    comment faire ?

  2. #2
    Membre émérite
    Homme Profil pro
    Autre
    Inscrit en
    Juillet 2021
    Messages
    433
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Autre

    Informations forums :
    Inscription : Juillet 2021
    Messages : 433
    Par défaut
    Bonjour,

    Pas sûr d'avoir compris la question mais tu peux essayer d'ajouter le paramètre pics dans un input hidden :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <input type="submit" name="val" value="Valider">
    <input type="hidden" name="pics" value="<?= htmlspecialchars($_GET['pics'] ?? 'De_1_à_50') ?>">

  3. #3
    Membre confirmé Avatar de zool.bzh
    Homme Profil pro
    peintre industriel
    Inscrit en
    Octobre 2023
    Messages
    150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Côtes d'Armor (Bretagne)

    Informations professionnelles :
    Activité : peintre industriel
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2023
    Messages : 150
    Par défaut
    oK c'est bon pour moi, merci Pytet

+ Répondre à la discussion
Cette discussion est résolue.

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo