Issue
Hiho,
I would like to be able to add an incremental string to the filename.
e.g. filename.php?increment=1
Is this possible? I would like to catch the string $increment and use that counter in the page it belongs to.
The main page should fill a list of links, generated from one base php file that gets the incremental counter from the string added tot the filename.
I'll elaborate a bit more ;) It's my first time asking something here and no idea how to ask this properly.
The mainpage should fill with links to one php file. That one phpfile generates a list of filenames, e.g. img_001.jpg A variation of that page should be able to create a list like img_001-1.jpg Where -1 comes from the integer added by the index.php file to filename.php=1
Solution
You can get the incremented value using php get function which is $_GET
<?php
$increment = isset($_GET['increment']) ? intval($_GET['increment']) : 1;
echo "Increment value: $increment";
?>
For Dynamic link generation then you can use this:
<?php
$numLinks = 5;
for ($i = 1; $i <= $numLinks; $i++) {
echo "<a href='filename.php?increment=$i'>Link $i</a><br>";
}
?>
Answered By - Shavy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.