say my url is http://10.50.1.2/mycgi.pl?records_per_page=10 it'll display 10 lines in the page. now if you click the link from the main page, the url is actually, http://10.50.1.2/mycgi.pl so you click it, no lines will displayed in the page. Then you need to click the "submit" to see results. If i want to see 10 lines by default at the 1st time, how should i do that ?
【在 w*s 的大作中提到】 : say my url is : http://10.50.1.2/mycgi.pl?records_per_page=10 : it'll display 10 lines in the page. : now if you click the link from the main page, : the url is actually, : http://10.50.1.2/mycgi.pl : so you click it, no lines will displayed in the page. : Then you need to click the "submit" to see results. : If i want to see 10 lines by default at the 1st time, : how should i do that ?
X*r
7 楼
Many ways to do it, e.g. 1) make mycgi.pl have a default 'records_per_page' of 10 (or whatever number you want on the first page). OR 2) change the link on the main page to point to 'mycgi.pl?records_per_page= 10'
【在 w*s 的大作中提到】 : say my url is : http://10.50.1.2/mycgi.pl?records_per_page=10 : it'll display 10 lines in the page. : now if you click the link from the main page, : the url is actually, : http://10.50.1.2/mycgi.pl : so you click it, no lines will displayed in the page. : Then you need to click the "submit" to see results. : If i want to see 10 lines by default at the 1st time, : how should i do that ?
w*s
8 楼
how to do the option 1 pls ?
number
【在 X****r 的大作中提到】 : Many ways to do it, e.g. : 1) make mycgi.pl have a default 'records_per_page' of 10 (or whatever number : you want on the first page). : OR : 2) change the link on the main page to point to 'mycgi.pl?records_per_page= : 10'
X*r
9 楼
By changing the perl source code, of course. I assume you're the developer?
【在 w*s 的大作中提到】 : how to do the option 1 pls ? : : number
d*n
10 楼
1.server 方面,每次用户submit时候,同时返回一个当前记录的指针。 这个指针用来跟踪哪10个记录已经被显示了。作为一个parameter 回到你 的perl script中。 假设你用 perl+mysql sub get_nth_record{ $nth=$_[0]; // keep user returned pointer $stmt=$_[1]; // and more params mysql="SELECT * from myTABLE where conditions limit nth,nth+10";
return mysql_results; } ^好久不用perl了,惭愧 2.if you do it from client side, that will be better. use javascript. save all the results (if not too many) into an array object. keep a global value/pointer to save current record. only to display nth 10 records. that is basic.
【在 w*s 的大作中提到】 : say my url is : http://10.50.1.2/mycgi.pl?records_per_page=10 : it'll display 10 lines in the page. : now if you click the link from the main page, : the url is actually, : http://10.50.1.2/mycgi.pl : so you click it, no lines will displayed in the page. : Then you need to click the "submit" to see results. : If i want to see 10 lines by default at the 1st time, : how should i do that ?
w*s
11 楼
brother, i know you have been warmhearted to help, but if if you treat Chinese just like Indians treat Indians, then you will have more chance to survive in IT in the future. i got this from linuxquestions, In your program, check for environment variable QUERY_STRING: if it is empty , simply act as if it were record_per_page=10 what happened is i was too tired and forget to take care the default for one of the variables.
【在 X****r 的大作中提到】 : By changing the perl source code, of course. I assume you're the developer?
w*s
12 楼
thanks a lot !
【在 d****n 的大作中提到】 : 1.server 方面,每次用户submit时候,同时返回一个当前记录的指针。 : 这个指针用来跟踪哪10个记录已经被显示了。作为一个parameter 回到你 : 的perl script中。 : 假设你用 perl+mysql : sub get_nth_record{ : $nth=$_[0]; // keep user returned pointer : $stmt=$_[1]; // and more params : mysql="SELECT * from myTABLE where conditions limit nth,nth+10"; : : return mysql_results;
X*r
13 楼
Thanks for the advice. Next time I should resist the temptation that would end in digging a hole for myself when browsing.
empty one
【在 w*s 的大作中提到】 : brother, i know you have been warmhearted to help, : but if if you treat Chinese just like Indians treat Indians, : then you will have more chance to survive in IT in the future. : i got this from linuxquestions, : In your program, check for environment variable QUERY_STRING: if it is empty : , simply act as if it were record_per_page=10 : what happened is i was too tired and forget to take care the default for one : of the variables.
w*s
14 楼
you can search answers in google if you know what to search, same as my question. since i didn't know the answer, i didn't know what to ask. certainly i appreciate your help a lot !
【在 X****r 的大作中提到】 : Thanks for the advice. Next time I should resist the temptation : that would end in digging a hole for myself when browsing. : : empty : one