how to create previous and next page links in php

I want to create pagination system for html files. I have created below mentioned php code:

$data = simplexml_load_file('epub_content/siddhartha3/OPS/package.opf');
$data->registerXPathNamespace('opf', '');
$itmrefcount = $data->spine[0]->itemref->count();
$itmref = $data->spine[0]->itemref[0]->attributes();
$itmrefid = $itmref['idref'];

echo 'Itemref count is : ' . $itmrefcount;

foreach ($data->spine->itemref as $itemref) {
$r = (string)$itemref->attributes()->idref;

foreach ($data->manifest->item as $item) {
$i = (string)$item->attributes()->id;
$h = (string)$item->attributes()->href;

if ($r == $i) {
//echo PHP_EOL . '<a href="epub_content/siddhartha3/OPS/' . $h . '">' . $i . '</a> ';

$url = 'epub_content/siddhartha3/OPS/' . $h;

//echo $_SESSION['curhtmlurl'];
$prm = new wlWgParam('<body>');  //the desired tag to be extracted

echo '<div id="contextract" class="well well-small" contenteditable="false">';

$wp = new wlWgProcessor(
$url, //the targeted real url
$prm, //the grabbing parameter
0     //no caching needed - it's a search engine :)


$result = $wp->get();
echo $result[0][0];
echo '</div>';




file_put_contents('epub_content/siddhartha3/OPS/package.opf', $data->saveXML());


Open in new window

Please advice how to do that?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Where would we find the test data?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnLourduAuthor Commented:
Below is my test url.

My test page is behind the login page. You can register yourself using Register button. Otherwise use below user name and password.

user name : john_15071978
password: Jesus12#$

After login you can see Bookshelf. You can click any of the book except Page Blanche because it is fixed layout book, it leads to page1.php. This page is my testing page.

Basically I have creating ePub editor using simple Readium JS.
Readium JS dynamically loads ePub pages in iframe.
On click of the 'library-edit-btn', I have enable HTML5 contenteditable option to edit that html file.
On click of the 'library-save-btn', I have created dynamic form elements with values and post the form using ajax to update that html file.
All these works fine for me. Server side files are updated.
But I refresh my page, updates are gone in client side.
I guess modern browsers load dynamic iframe content from cache.
Last couple of weeks I have tried some workarounds, but those are not helpful.
So I decided to drop iframe idea. And try to pull html files in separate div elements using php.
But I need to navigate these html files using previous and next buttons.
Please advice, how to include navigation buttons with functionality in php?
Your quick response is very much appreciated.
Ray PaseurCommented:
The test URL is 404, sorry.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

JohnLourduAuthor Commented:
Currently working for me. I have attached screenshot for your reference. Please try again once.
Jason C. LevineNo oneCommented:
Nope, 404 for me too.
JohnLourduAuthor Commented:
Sorry, there is some typo. Correct url is,
JohnLourduAuthor Commented:
I understand this should be done only using jquery and php. Not pure php. sorry for inconvenience.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.