[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

can't hand over parameters from html to perl!

Posted on 2000-04-26
3
Medium Priority
?
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 …
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…
Six Sigma Control Plans

656 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