CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Search query values using



May 22, 2000, 8:13 AM

Post #1 of 2 (555 views)
Search query values using Can't Post


I made a simple search script, and to use multiple pages i need to pass the vars using
for example...

How do i get the script to transform the
'perl guru' that the user typed, into the 'perl+guru' ? And how to get it to interpret the 'perl+guru' as 'perl guru' when the user wants to view the next page?

Thanks to you all in advance


May 21, 2000, 10:09 PM

Post #2 of 2 (556 views)
Re: Search query values using [In reply to] Can't Post

In fact, the browser translates what the user types into an URL-escaped string, and the module will translate it back to the original value.

This is usually the most handy, because you don't have to worry about how exactly these things are encoded.

So you'd simply get the original query by asking for it :
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

$query = param('query');
$page = param('page');</pre><HR></BLOCKQUOTE>

Unfortunately, the escape() and unescape() functions of are not directly available. So when you want to build your own links with the same query information, but with a different page number, it's probably easiest to change the page number like this :
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

for $nr (1 .. 10) {
param('page', $nr);
$myself = self_url();
print a({href=>$myself},$nr), " ";

You can use similar code if you're using the object-oriented syntax of

Maybe someone else knows a shorter way to do this ?


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives