
Hello, I have a problem to compare two dates, when they are identical (one is defined in one form and the other in a custom post type, reservation).
But nothing works.
Here my code
<form class="DateReservationTerrains" action="<?php echo get_permalink(); ?>" method="post">
<label>Date: <input type="text" id="DatePicker" name="date" autocomplete="off"></label>
<label>Heure: <input id="TimeForm" type="text" class="time ui-timepicker-input" autocomplete="off" name="time"></label>
<input type="submit" value="Je check les disponibilités" name="submit">
</form>
<div class="resultatPost">
<?php
if(isset($_POST['submit'])){
$ChoixDate = $_POST['date'];
$ChoixTime = $_POST['time'];
echo '<p>Vous avez choisi le '. $ChoixDate . ' à ' .$ChoixTime.'</p><hr>';
}
?>
</div>
<?php
$args = array(
'post_type' => 'reservation',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$loop = new WP_Query( $args );
?>
<ul style='margin-top:25px;'>
<?php
if( get_field( 'date_de_reservations' ) == $ChoixDate): ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li><?php the_title(); ?>, le <?php echo get_field('date_de_reservations'); ?> à <?php echo get_field('heure_de_reservation'); ?> sur le <?php echo the_field('numero_du_terrains'); ?>
</li>
<?php endwhile;?>
<?php endif; ?>
</ul>
Help plz?
Thanks!