Solved

can't hand over parameters from html to perl!

Posted on 2000-04-26
3
170 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 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