Hi there! , I would like to know how I could create periods for different years and that when the user selects the desired period, they show me the records of that year, I do not understand well the logic of how I could build it, create a years table with the id,years fields, to save the years (periods) to be able to show it by a select , it produces the save and it is shown to me in the select , but I would like to know that when you select the new period they show me those records and that I start counting the id again at 1 for each year , In advance they would help me a lot! Here I produced the example Select:
$anio = filter_input(INPUT_POST, 'anio');
$cons = "SELECT years FROM ano";
$res = mysqli_query($con, $cons);
<form class="container" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
<select name="anio" id="anio" required>
<?php while ($fila = $res->fetch_assoc()) { ?>
<option value="<?php echo $fila["years"] ?>">
<?php echo $fila["years"] ?>
</option>
<?php } ?>
</select>
<input type="submit" value="Buscar">
</form>
(PS: I have already asked this question several times and many people helped me and I thank them!, but perhaps I have not posed the question very well, I hope that this time I have posed my question well, Thank you very much in advance!)
I propose a simplified version of what you need:
As well as the dataset so you can test it:
It's more or less what you've tried to do, so I don't think you need much explanation. Leave me any questions in the comments and I will expand the answer with the clarifications you require.