A suggestion here:
First, your input could be located in a form:
<form action='action_code.php' method="post">
<input id="startdate" type="date" name="startdate" />
<input id="enddate" type="date" name="enddate" />
<input type="submit" value="Submit">
</form>
and the action_code.php file would contain:
<?php
$startdate = $_POST['startdate'];
$enddate = $_POST['enddate'];
if($enddate < $startdate){
echo 'enddate has to be after startdate';
}else{
echo 'form submitted';
echo $startdate;
echo $enddate;
}
echo '<a href="/home.php">Back home</a>';
?>
What is to retain here is that dates can be compared using comparison operators likewise numbers. I omitted any formatting in order to keep the code clean.