0
I’m a beginner in PHP, I’m trying to create a button, and according to that I was clicking the next line of the file would be displayed.
1st click - line 1 is displayed / 2nd click - line 2 is displayed / and so on
<?php
$linhas = file("texto.txt");
for($i = 0;$i < count($linhas);$i++) {
echo "<button value='". $linhas[$i]. "'>". $linhas[$i] ."</button>";
}
?>
But in the code above, all the lines end up turning buttons:
What I would like to happen: If the code is reading line 5, it will display only line 5. If the code is reading line 6, it will display only line 6.