$event = $_GET['event'];
$id = $_GET['id'];
$stmt = $conn->prepare("SELECT * FROM events WHERE event_name=? AND event_id=?");
$stmt->bind_param("ss", $event, $id);
$stmt->execute();
while($db_data = $result->fetch_assoc()){
$title = $db_data['event_name'];
$description = $db_data['event_description'];
$location = $db_data['event_location'];
$event_date = $db_data['event_date'];
$event_time = $db_data['event_time'];
$end_date = $db_data['end_date'];
}
I am fetching the date from the database, then converting it like so,
$Date = str_replace('/','-',$event_date);
$newDate = date('Y/m/d', strtotime($Date));
However, nothing is displayed on the date input(last input) in the browser when I do this. Note the value $event_date is stored as 2020-02-31 i changed the date's format to YYYY/MM/DD as shown above, the days and months are padded with a 0 and still it doesn't work as suggested here
<div class='container mt-4 p-4 col-md-6 text-light'>
<form autocomplete='off' action='update-event.php' method='post'>
<div class='form-group'>
<label for='title'>Event Name</label>
<input type='text' class='form-control' name='event-name' value='".$title."'>
</div>
<div class='form-group'>
<label for='title'>Description</label>
<textarea class='form-control' name='event-description'>".$description."</textarea>
</div>
<div class='form-group'>
<label for='location'>Event Location</label>
<input type='text' class='form-control' name='event-location' value='".$location."'>
</div>
<div class='form-group'>
<label for='Event Date'>Event Date</label>
<input type='date' class='form-control' name='event-date' value='"; echo $newDate; echo"'>
</div>
</form>
</div>