Solved

can't hand over parameters from html to perl!

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 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

21 Experts available now in Live!

Get 1:1 Help Now