I am in the middle of making a web based system for shows and each show as a different closing date for entries. The closing date is stored in a database. I need to display a export to excel button once the closing date has passed for each show.
I have already done the export to excel button and that works but it's clickable all the time, I need the button to only be clickable once the closing date for each show has passed. I'm thinking I need to check if the closing date in the database has passed compared to todays(current) date.
Not sure how it would work if each show has a different closing date though?
Below is what I came up with but know it's way off
<?php
$sql="SELECT closing_date FROM shows";
$result1 = mysqli_query($mysqli, $sql);
while($info = mysqli_fetch_assoc($result1)){
if(date('Y-m-d') > $info['closing_date'] ){
echo '<input type="submit" name="export_excel" class="btn btn-success float-md-right" value="Export to Excel">';
break;
}
elseif(date("Y-m-d") < $info['closing_date'] ){
echo '<a href="javascript:void(0);"><input type="submit" name="export_excel" class="btn btn-dark float-md-right" value="Export to Excel"></a>';
break;
}
}
?>