I am using array to limit the results from glob(), like a pagination
$show = array(5,10,15,20);
$directories = glob(__DIR__.'/*', GLOB_ONLYDIR);
$directories = array_slice($directories, 0, $show[0]); // shows first 5 folders
How can I add value of 1 to $show[0] using a button?
if(isset($_POST['submit'])){
echo 'click submit to show 10 items, click again to show 15 items and so on';
};
You'll need to record the current state of the page in some way. You can do this with a hidden variable, however I would recommend either switching to
$_GETfor this function, or simply using a query string (as I've done here). That way you can go to the correct pagination directly in the browser URL bar.PHP code:
Then you can do something like this for the HTML form (using the query string method I mentioned)