Hi there guys & gals, this is my first post here will try to be as accurate as possible.
The problem i have seems to me to be quite basic but i cannot for the life of me work out how i can do it, am hoping you good folks can point me in the right direction.
I have data in .txt file format, single line per entry, passed into an array, single line to be displayed per page, what i cannot figure out is how to make a 'next page' and 'previous page' link to modify the var's i am using to correctly get the line in the file.
Here is my current php code active on the page it currently grabs var's from the address line
example: file.php?file_select=ttc01-10&chapter=8 where file_select = filename of the .txt file and chapter = the line to read and displayed.
Any advice, hints or tips would be greatly welcomed:
$file_select = 'ttc_intro';
if ($HTTP_GET_VARS) $file_select = $HTTP_GET_VARS['file_select'];
if ($HTTP_POST_VARS) $file_select = $HTTP_POST_VARS['file_select'];
$chapter = 0;
if ($HTTP_GET_VARS) $chapter = $HTTP_GET_VARS['chapter'];
if ($HTTP_POST_VARS) $chapter = $HTTP_POST_VARS['chapter'];
$file_selected = $file_select.'.txt';
$lines = file($file_selected);
$line = $lines[$chapter];
print '<br />';
print '<table width="685" align="center" cellspacing="1"><tr class="title_colour"><td colspan="2"><div align="center">';
print $line;
print '</div></td></tr><tr class="title_colour"><td width="338"><div align="center">
<strong><< Previous Chapter </strong></div></td><td width="340">
<div align="center"><strong>Next Chapter >> </strong></div></td></tr></table>';
print '<br />';
And what i would like is to get two links that update based on the var's to the previous line and the next line in the array.
Take care, and thanks for any replies :)