473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I put a filter expression in the URL using Perl?

10
I have issue regarding paging using filter expression. Here's the piece of code for filtering:

Expand|Select|Wrap|Line Numbers
  1. if ( $q->param("Filter") )
  2.             {
  3.             $Id=$q->param('User_Id');
  4.             $Name=$q->param('User_Name');
  5.  
  6.            if ($Id ne "" )
  7.                 {
  8.               $filterexpression= $filterexpression." UserId like '" .$Id. "%' and " ;
  9.                  }
  10.             if ($Name ne "" )
  11.               {
  12.             $filterexpression= $filterexpression." UserName like '" .$Name. "%' and " ;
  13.                }
  14.               }
  15.             $filterexpression= $filterexpression. " UserId > 0"
and here's chunk of the paging code:

Expand|Select|Wrap|Line Numbers
  1. print qq[<td><a href="UsersList.cgi?
  2.          pageNum=$pageN&limit=$limit&SortBy=$SortBy&SortOrder=$SortOrder">&lt;</a></td>];
  3.  
The issue is I want to put the filter expression in this HREF after the sort order variable,
so that after filtering when I go for paging then only those records confined to the filter expression should be shown.

I tried to merge this way:

Expand|Select|Wrap|Line Numbers
  1. print qq[<td><a href="UsersList.cgi?
  2.                 pageNum=$pageN&limit=$limit&SortBy=$SortBy&SortOrder=$SortOrder
  3.                  &Filter=$filterexpression">&lt;</a></td>];
but in URL I got to see something like this:

Expand|Select|Wrap|Line Numbers
  1. http://localhost/cgi-bin/UsersList.cgi?
  2.                   pageNum=1&limit=3&SortBy=UserId&SortOrder=Asc&filter=%20%20UserId%20like%
  3.                   20'1%'%20and%20%20UserId%20>%200
Later I tried to put the `$Id` value in a varible like:

Expand|Select|Wrap|Line Numbers
  1. $string =~ m/^$Id/;
but when I tried printing this variable I got nothing.PLEASE HELP ME OUT FIND THE SOLUTION,and apart from using CPAN is their any other solution because i am having 0% knowledge about it.
Oct 7 '10 #1
1 1574
numberwhun
3,509 Expert Mod 2GB
Please be sure and use code tags around any code that you put into the forums.
Oct 8 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sam | last post by:
I would like to store html templates in a database. By using perl I would like to retrive the template ask the user to fill the template and store the whole file is template + the user data in a...
6
by: atinti | last post by:
I'm tyring to write something that will send a simple email using Perl so far this is what I have #!/usr/bin/perl -w use strict; my $executable = "saplotus.exe'; my $server =...
38
by: bdockery | last post by:
One to Many relationship: Manufactuerer to Model Manufactuerer table has , Products Table has , ,
8
crazy4perl
by: crazy4perl | last post by:
hi all !!! i m new to perl. can anyone here please tell me how to communicate with websites using perl. do we need to use CGI for that or simply by using perl... simply i just wnt to fill some...
5
by: wbosw | last post by:
I'm trying to filter the datatable at runtime from data selected from dropdown listboxes and a texbox. I place the values into variables and use the variables in the filter expression. However,...
3
by: Max58kl | last post by:
Trying to access data and print it to the screen using Perl Builders I/O Window -------------------------------------------------------------------------------- Hi I am using a program called...
2
by: danny2000 | last post by:
Hi all. Please excuse my ignorance here, but is it possible and / or efficient to do things such as insert worksheets, make charts, pivot tables, filter data in an excel workbook using Perl? ...
3
by: poolboi | last post by:
hi guys, i dunno if this post should be in Perl or MySQL but i'm using Perl DBI to do manupilations now in MySQL i've got problem trying to input 2 arrays of data into 2 fields at the same...
3
by: Sidra Nisar | last post by:
Hello……I am working on voice transmission control through linux as my project in high school……I need to know if the comments I have made on the following program are correct…. Object of the perl...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.