"a new page shuld not be loaded . the new data should come in the same page"
You could simulate that using frames, possibly.
A lot of your code doesn't make much sense to me. For example;
for $i (1 .. $total_pages)
{
if ($i == $page)...
I don't see that
$page has ever been defined. You should
use warnings; and
use strict;, check your
code using
perl -c yourscript.pl, and some of the obvious errors will be revealed to you.
(Also, if you try to use correct spelling and formatting - like beginning sentences with caps, putting periods or question marks at the ends of sentences, etc, and generally make it look as if you took some care in your posting,
you may get more responses, at least IMHO.)