[nycphp-talk] (no subject)
David Krings
ramons at gmx.net
Fri Nov 8 12:53:22 EST 2013
On 11/8/2013 11:57 AM, John Randall wrote:
> I am fairly new to php and Javascript, as well as new to this list.
> I have a query to Solr using php, which works fine. I use a form page, with
> <form method= GET and an <input type = submit to activate the query, sending
> the first 10 hits to a table on a separate results page. However, on the
> results page I would like to add a button (type=submit or type=button) that
> would retrieve the next set of 10 records. On the results page, I set the
> $limit variable to 10 and this remains fixed, because I only want 10 records
> at a time. I set the $offset variable to 0 for the first set of results and
> try to increment it by 10 for the next set ($offset +=10;). However, as I
> understand html, once the results page is rendered, the $offset variable dies,
> so it cannot be incremented.
> I've tried making $offset global, but without success.
> I've tried using <input type=button with a JavaScript function to
> increment $offset, but it doesn't seem to remember the previous value.
> Does anyone have any ideas? Thanks in advance.
Hi!
Welcome to the list!
One other option you can try is writing the value into a session cookie. IIRC
if you set the cookie to expire in the past then it will get dropped by the
browser as soon as the current session ends. Session support is very easy to
use in PHP. See here
http://us3.php.net/manual/en/ref.session.php
Hope this helps.
David
More information about the talk
mailing list