Jump to content

This topic is 6933 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi there, PHP gurus.

I'm using fm-and-php from schubec to integrate FMS8A into a website already built using php.

I want to build a form for users to submit a query, then get a display of records that match the query. Read only, so it seems like a really simple chore.

I have an html form that collects the one piece of information I want to search, and a form action page that returns the results in tabular format.

This is all swell, the trouble comes when I want to navigate from the first page of results to some other page of results. Using fm-and-php's built-in function of getListNavigation() gives me links to other pages, but when I use them, I lose my found set. Clearly, I need to resubmit the original query, along with the 'skip' value for the number of records to skip. But how?

Do I store it in some kind of global variable? Do I have to write it to a database somewhere? How do you do these things?

As it is my first effort at either web page construction or PHP work, I'm feeling a little lost. Yes, I'm going to the library to get a book on PHP, but that won't help with this specific problem.

Any help is appreciated.

Thank you in advance.

Posted

Without knowing anything about the "FM-AND-PHP" Class. You can still write the page links "< Prev", "Next >" etc. These would include the search term and the calculated off-set. However, some knowledge of PHP programming would be required (maybe after you read the book - tomorrow :)

Someone may have this already written and they may be willing to pass it on ;) , or the getListNavigation() function may have a good way of handling this (if only I could read German).

Good Luck.

Garry

Posted

Solved!

I need to use a form method="GET" to encode the server query into the URL. That's probably a 'DUH' for experienced PHP folk, but I still don't get it.

fm-and-php seems to be ambivalent about which method is used, but I couldn't get it to work with "POST".

Hope that helps someone.

  • 2 weeks later...
Posted

Hi,

you need to add the parameter 'skip=x', where x is the number of records you want to skip and the line:

$FM->setSkip($_REQUEST['skip']);


to the fm-and-php query.



The parameter skip in your url is then read by the 'setSkip' function in fm-and-php.

That will skip 'x' records in your result.



Adding the commands:



echo $FM->getFoundCount() . " records showing " . $FM->getCurrNumShowing() .". 

";

echo $FM->getLinkFirst($label = "<< Start") . "  ";

echo $FM->getLinkPrevious($label = "< Prev") . "  Page:" . $FM->getListNavigation() . "  ";

echo $FM->getLinkNext($label = "Next >"). "  ";

echo $FM->getLinkLast($label = "End >>");

will add list navigation, automatically adding the 'skip' parameter to your url.

Hope it helps....

Reg Herrix

This topic is 6933 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.