Hello everybody i hope everybody is doin well, Actually i have a table in which i fetch the data from sqlite database,i have done the paging and filtering for the grid using per
Client side table sorting is achieved with Javascript. There are dozens of libraries easily found by a simple Web search. Stuart Langridge's sorttable is very easy to implement.
This is not an answer to your question, but general advice. Therefore, I have made it community wiki.
Please stop writing CGI scripts for a while until you understand why your script has serious problems.
You have:
use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
# ...
my $query = new CGI;
my $q = new CGI;
First, note that you need to initialize a CGI object only once. Avoid indirect method calls:
my $cgi = CGI->new;
I know the CGI.pm docs use $query
but I find $cgi
to be more meaningful.
That is a good step. Almost all CGI scripts should use well established libraries rather than homebrew code. However, after that good first step, you do:
print "Content-Type: text/html\n\n";
$query = $ENV{'QUERY_STRING'};
@list = split( /\&/, $query);
foreach (@list) {
($var, $val) = split(/=/);
$val =~ s/\'//g;
$val =~ s/\+/ /g;
$val =~ s/%(\w\w)/sprintf("%c", hex($1))/ge;
($var, ' = ', $val,);
}
There is no reason to engage in cargo-cult practices. Your CGI object already has the parameters passed to the script.
Also, you should declare your variables where they are first used as opposed to dumping all of them at the script.
Use CGI.pm's header
to send the header. You have:
print <<END_HTML;
<html>
<head><title></title>
</head>
<body>
<form action="Filtering.cgi" method="post">
<TABLE>
<TR>
<TD>
<input type="hidden" name="submit" value="Submit">
</TD>
</TR>
</TABLE
</form>
</body></html>
END_HTML
which makes no sense as you have sent a complete HTML document before doing anything else in the script.
The rest of the code cannot change what you have already sent.
Put your HTML in a template. Personally, I like HTML::Template for the clean separation between code and content.
This way, you can write your Perl script to generate the content and include any client side functionality in the template separately.