I want to break up lengthy content into pages with next and previous links.
My content is stored in $text.
When using the following code my next page links work but when I click on a previous link I get a file not found error:
if (!isset($page)) $page=0;
$textarray = split("[PAGEBREAK]",$text);
$text=$textarray[$page];
if ($page !=0) {
$prevpage=$page - 1;
echo("<P><a href=\"PHP_SELF?page=$prevpage\">".
"Previous Page</a></P>");
}
echo ("<P>" . $text . "</P> ");
if ($page < count($textarray) - 1) {
$nextpage = $page + 1;
echo("<P><a href=\"$PHP_SELF?page=$nextpage\">".
"Next Page</a></P>");
}
Can anyone help?