Solved

How to pass a parameter for a perl script through the "FORM ACTION" of an HTML

Posted on 1997-05-20
2
355 Views
Last Modified: 2013-12-25
Hi ALL,
I want to pass two parameters for a perl script using the path of "ACTION" within an HTML form. If input data is inserted and a perl script without a parameter is run, the data is normally passed. However, if the URL below is used to pass two parameters, these parameters were not passed although the data which was inserted through the fill-out form is printed without any problem.
I would be grateful if anyone could answer this qustion.

-----
 <FORM METHOD="GET" ACTION="http://goldstar/cgi-bin/user7/diff.pl?FILEID=$comp_id&FILENAME=$file_name">
<INPUT NAME="field1"> <P>
<INPUT NAME="field2"> <P>
To submit the query, press this button: <INPUT TYPE="submit"
VALUE="Submit Query"> <P>
</FORM>
---------------------------------
When the perl script(diff.pl) was run the URL was as follows:
http://goldstar/cgi-bin/user7/diff.pl?field1=1.4&field2=1.5
-----
0
Comment
Question by:dcs0ock
2 Comments
 

Author Comment

by:dcs0ock
ID: 1828052
Edited text of question
0
 
LVL 5

Accepted Solution

by:
icd earned 20 total points
ID: 1828053
I think you have mixed up your html and your perl in that example but I see what you are trying to do.

One way to pass extra variables is to use the 'hidden' data type. You would change your 'html' to:-

<FORM METHOD="GET" ACTION="http://goldstar/cgi-bin/user7/diff.pl">
<INPUT NAME="field1"> <P>
<INPUT NAME="field2"> <P>
<INPUT TYPE="HIDDEN" NAME="FILEID" VALUE="$comp_id">
<INPUT TYPE="HIDDEN" NAME="FILENAME" VALUE="$file_name">
To submit the query, press this button: <INPUT TYPE="submit" VALUE="Submit Query"> <P>
</FORM>

An alternative that you might want to play with is changing from method GET to method POST. You should then be able to use your program as it is although this depends on how your cgi-bin.pl program is written. Most standard ones that I have seen check either for one or the other, not both. If however it was modified to accept both then your program should work.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio‚Ķ
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

828 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