Solved

can't hand over parameters from html to perl!

Posted on 2000-04-26
3
167 Views
Last Modified: 2006-11-17
Hi!

I have a HTML-page with a simple link to mp3.pl. It works fine. But how to hand over parameters? I tried:
<a href="mp3.pl?key1=value1&key2=value2> and so on.
I guess thats the post-methode(?). So I read in the parameters with:
read(STDIN, $Income, $ENV{'CONTENT_LENGTH'});

But the mp3.pl don't get ANY parameters!

It works with forms (and submit-buttons), so, what do I wrong????

MfG Panther
0
Comment
Question by:pantherchen
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 100 total points
ID: 2751444
"<a href="mp3.pl?key1=value1&key2=value2>"

The method you are using above is the GET method.

Here is a brief explanation of the difference between GET and POST methods.

CGI scripts are called in two main ways.
The HTTP GET method is used in document retrievals where an identical request will produce an identical result, such as a dictionary lookup. A GET stores form data in the URL. This means it can be conveniently bookmarked for canned requests, but has limitations on the total size of the data requested.

The HTTP POST method sends form data separate from the request.
It has no such size limitations, but cannot be bookmarked. Forms that update information on the server, like mailing in feedback or modifying a database entry, should use POST. Client browsers and intervening proxies are free to cache and refresh the results of GET requests behind your back, but they may not cache POST requests. GET is only safe for short read-only
requests, whereas POST is safe for forms of any size, as well as for updates and feedback responses.

===========================================

Here is the mp3.pl script that will help you read incoming variables from your HTML form.

i am assuming that you have already have the CGI.pm PERL module installed on your system.

This program will read the parameters that you are sending, either via a POST method or a GET method and display the values of those variables on your screen/browser.

#!/usr/local/bin/perl

use CGI;

$query=new CGI;

$key1=$query->param('key1');
$key2=$query->param('key2');

print "Content-type: text/html\n\n";

print $key1,"<br>\n";
print $key2,"<br>\n";
=============================

Hope that helps
0
 
LVL 1

Author Comment

by:pantherchen
ID: 2751534
Yeah, it works fine! Thank you very much (I've already spent about 4 hours by solving it by myself)!!!!!
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2751578
Glad to know that your problem was solved. :-)

Rgds
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now