Current location: Hot Scripts Forums » Programming Languages » Perl » retrieving specific data from parsed query string


retrieving specific data from parsed query string

Reply
  #1 (permalink)  
Old 03-31-04, 08:48 AM
grayfox grayfox is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question retrieving specific data from parsed query string

Hi everybody,

I have a little problem retrieving a specific variabel from my parsed string.

the URL looks like this:

URL?submit=send&number=2&total=10&nums_todo=18&num s_done=2

actually it is longer than that

I'm using a GET method

I use the following code (It is an example I got from the internet):

@Form = split (/&/, $ENV{'QUERY_STRING'});
foreach $i (@Form){
($name, $value) = split(/=/, $i);
}

My question is:
How do I retrieve the "2" from the "number" in the query string ? I only need to use that.
Can I put it in a variabel so that I can use it. I don't need the other information from the query string.

Help. I'm a beginner.

Last edited by grayfox; 03-31-04 at 08:52 AM.
Reply With Quote
  #2 (permalink)  
Old 04-04-04, 11:38 AM
YUPAPA's Avatar
YUPAPA YUPAPA is offline
Newbie Coder
 
Join Date: Sep 2003
Location: Antarctica
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

I think this is part of the code of getting the parameters from a URL.

You should use the CGI.pm module to handle this...

Code:
#!/usr/bin/perl
use CGI qw(:standard :form);
use strict;

my $cgi = new CGI;
my $number = $cgi->param('number');

print $cgi->header(-type=>'text/html');
print "The Number: " . $number . " \n";
When you call the URL like this... http://www.URL.com/script.pl?number=3, the page should display:

Quote:
The Number: 3
__________________
YuPaPa.CoM is my home ~
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
Mysql query string help nefariousphp PHP 3 12-08-03 06:51 AM
ASP SQL query string problem CollinAmes ASP 2 10-24-03 11:09 AM


All times are GMT -5. The time now is 04:57 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.