in reply to How to retain a value passed from another link to a script

Well, remember Re: How to get input text boxes populated? Exact same way

Write a subroutine to make links, make that subroutine retain the values

<a href="<!-- TMPL_VAR NAME=SomeKindOfLinkForOrderID -->">Details</a>

Then give the template return value of MakeSomeKindOfLinkForOrderID($query)

Same idea , subs subs subs Re: pagination links (logic)