Bonsoir,

je suis entrain d'essayer de faire un systeme de reservations et je rencontre un soucis sur la recuperation de champ date,
j'ai une date de debut et une date de fin (datepicker), j arrive a recuperer les dates de debut mais lorsque je veux recuperer les dates de fin la il ne me la prends pas!!!
auriez vous une petite idee de là ou je me trompe ?
je depose le code ci-dessous:

merci d'avance

Gilles

[code]
<?php
include '/lib/includes.php';
include '/partials/header.php';

/**

  • Récuperation liste des agences
    */

$select = $db->query('SELECT agences.id, agences.name, agences.numeric AS numagence FROM agences ORDER BY name ASC');
$agences = $select->fetchAll();
$agences_list = array();
foreach($agences as $agence){
$agences_list[$agence->numagence] = $agence->name;
}

/**

  • Récuperation liste des TYPES
    */
    $select = $db->query('SELECT types.id, types.name FROM types ORDER BY name ASC');
    $types = $select->fetchAll();
    $types_list = array();
    foreach($types as $type){
    $types_list[$type->id] = $type->name;
    }

$agence='';
$type='';
$conditions = '';

if(!isset($_POST['numagence']) && !isset($_POST['type']) && !isset($_POST['datedebut']) && !isset($_POST['datefin'])){
$select = $db->query("SELECT res.categorie, res.datedepart, agences.name, COUNT(numres) AS compteur
FROM res
LEFT JOIN agences ON res.agencedepart=agences.numeric
GROUP BY datedepart, name, categorie
");
$resas = $select->fetchAll();

        }elseif (isset($_POST['numagence'])){
            $agence=$db->quote($_POST['numagence']);
                $conditions = "WHERE res.agencedepart=$agence";
                $select = $db->query("SELECT res.categorie, res.datedepart, COUNT(numres) AS compteur, agences.name
                                            FROM res
                                            LEFT JOIN agences ON res.agencedepart=agences.numeric
                                            $conditions
                                            GROUP BY datedepart, categorie
                                            ");
                $resas = $select->fetchAll();
                $select = $db->query("SELECT agences.name
                                            FROM agences
                                            WHERE agences.numeric=$agence
                                            ");
                $recupagence = $select->fetch();

        }elseif (isset($_POST['type'])){
            $type=$db->quote($_POST['type']);
                $conditions = "WHERE agences.type_id=$type";
                $select = $db->query("SELECT res.categorie, res.datedepart, COUNT(numres) AS compteur, agences.name
                                            FROM res
                                            LEFT JOIN agences ON res.agencedepart=agences.numeric
                                            $conditions
                                            GROUP BY name, datedepart, categorie
                                            ");
                $resas = $select->fetchAll();

        }elseif (isset($_POST['datedebut'])){
            $debut=$db->quote($_POST['datedebut']);
                $conditions = "WHERE res.datedepart>=$debut";
                $select = $db->query("SELECT res.categorie, res.datedepart, COUNT(numres) AS compteur, agences.name
                                            FROM res
                                            LEFT JOIN agences ON res.agencedepart=agences.numeric
                                            $conditions
                                            GROUP BY name, datedepart, categorie
                                            ");
                $resas = $select->fetchAll();

        }elseif (isset($_POST['datefin'])){
            $fin=$db->quote($_POST['datefin']);
                $conditions = "WHERE res.datedepart<=$fin";
                $select = $db->query("SELECT res.categorie, res.datedepart , COUNT(numres) AS compteur, agences.name
                                            FROM res
                                            LEFT JOIN agences ON res.agencedepart=agences.numeric
                                            $conditions
                                            GROUP BY name, datedepart, categorie
                                            ");
                $resas = $select->fetchAll();

        }

?>
<div class="row">
<div class="large-12 columns">
<fieldset>
<form action="#" method="post">
<div class="row">
<div class="large-3 columns">
<label>Agences :</label>
<select name="numagence">
<option value="" disabled selected>Please select an option</option>
<?php foreach($agences_list as $key => $value): ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="left large-3 columns">
<label>Type (VL/VU) :</label>
<select name="type">
<option value="" disabled selected>Please select an option</option>
<?php foreach($types_list as $key => $value): ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="left large-3 columns">
<label>Date début :
<input type="text" name="datedebut" id="datedebut" class="datepicker" value="">
</div>
</label>
<label>Date fin :
<input type="text" name="datefin" id="datefin" class="datepicker" value="">
</div>
</label>
<br />
<button type="submit" class="right button tiny success round">Executer</button>
</div>
</div>
</form>
</fieldset>
</div>
</div>
<div class="row">
<?= $conditions; ?>
<div class="large-12 columns">
<fieldset>
<?php if(isset($_POST['numagence'])): ?>
<h3><?= $recupagence->name; ?></h3>
<?php endif; ?>
<table class="table table-striped">

<thead>
<tr>
<th>Agence</th>
<th>Date résas</th>
<th>Catégorie</th>
<th>Nbre résas</th>
</tr>
</thead>
<tbody>
<?php foreach($resas as $resa): ?>
<tr>
<td><?=$resa->name; ?></td>
<td><?= (date("d/m/Y",strtotime($resa->datedepart))); ?></td>
<td><?= $resa->categorie; ?></td>
<td><?= $resa->compteur; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</fieldset>

<br />

</div>
</div>
<?php include '/partials/footer.php'; ?>
[/code]

Aucune réponse