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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How to read a parameter

 



datlaravi
Deleted

Jun 23, 2000, 11:58 AM

Post #1 of 5 (611 views)
How to read a parameter Can't Post

Hi,
I have a link that shows http://www.server.com/modify.cgi?location="215 street"
I am working on modify.cgi. I want to get the parameter 'location' and do some query from the database.
how do i get the parameter 'location'
I included 'cgi-lib.pl' in modify.cgi and
i tried
$value = $in{location};
print "$value";
I am not getting the location.
How do i get it. I want to do some query on it.
Please help me


Kanji
User / Moderator

Jun 23, 2000, 4:45 PM

Post #2 of 5 (611 views)
Re: How to read a parameter [In reply to] Can't Post

You should be using CGI.pm instead of cgi-lib.pl.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

use CGI qw( :standard );
$value = param('location');
print $value;</pre><HR></BLOCKQUOTE>


datlaravi
Deleted

Jun 26, 2000, 5:57 AM

Post #3 of 5 (611 views)
Re: How to read a parameter [In reply to] Can't Post

HI,
I tried using CGI and used the above code.
The link is opening a notepad with the text.
'your browser sent information that the server could not understand'.
I am not able to get rid of that error.
Please help me.
Thanks


Kanji
User / Moderator

Jun 26, 2000, 6:29 AM

Post #4 of 5 (611 views)
Re: How to read a parameter [In reply to] Can't Post

That was a code snippet: you need to print out headers and such for it do anything useful.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

#!/usr/bin/perl -w

use CGI qw( :standard );

my $location = param('location')
&#0124; &#0124; '[nothing]';

print header,
'You entered: $location';</pre><HR></BLOCKQUOTE>

Don't forget to take the space out from in-between the &#0124; &#0124;.


datlaravi
Deleted

Jun 26, 2000, 7:17 AM

Post #5 of 5 (611 views)
Re: How to read a parameter [In reply to] Can't Post

HI,
I tried using the code.
It is printing 'Nothing';
I am still getting the error when i click on the link that it is a bad request.

 
 


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

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