I have some code (http://devzone.zend.com/article/3336-Re ... s-with-PHP) that read the contents of an excel spreadsheet and then puts this into an array.
I have it so that it outputs the contents of the array onto the screen, what I would really like is for it to only show one record from the array at a time, and for the user to then click a 'next' to see the next record within the array, preferably without having to reload the whole page
Is there a way to do this, perhaps with a combination of css and php.
php to Navigate Through Records
Moderator: General Moderators
Re: php to Navigate Through Records
You would probably want to do this with Javascript, because to do it with php you would need to use $_SESSION variables to achieve persistence from one call to the next. I guess that could be done, but if your array is very large, there might be a problem with server memory. Anyone know what limits there may be?millsy007 wrote:I have some code (http://devzone.zend.com/article/3336-Re ... s-with-PHP) that read the contents of an excel spreadsheet and then puts this into an array.
I have it so that it outputs the contents of the array onto the screen, what I would really like is for it to only show one record from the array at a time, and for the user to then click a 'next' to see the next record within the array, preferably without having to reload the whole page
Is there a way to do this, perhaps with a combination of css and php.
Re: php to Navigate Through Records
It would probably be around 10-15 records (each containing a few lines of text) so memory shouldnt be an issue.
I think javascript is the way forward, I have found fairly similar things around image galleries, however I basically need to cycle through content.
I think javascript is the way forward, I have found fairly similar things around image galleries, however I basically need to cycle through content.
Re: php to Navigate Through Records
That being the case, I will move this topic to Client Side.millsy007 wrote:It would probably be around 10-15 records (each containing a few lines of text) so memory shouldnt be an issue.
I think javascript is the way forward, I have found fairly similar things around image galleries, however I basically need to cycle through content.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Re: php to Navigate Through Records
Simple technique would be:
- Output the whole thing with the starting item identified by a class
Code: Select all
<ul id="munchkin"> <li>foo</li> <li class="show">bar</li> <li>zim</li> </ul> - Use CSS to hide everything except the show
- Add some JS that runs when some hyperlinks, elsewhere in the markup, are clicked. jQuery is good for that
