Solved

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

Posted on 1997-05-20
2
354 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

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

Suggested Solutions

Title # Comments Views Activity
Wallpaper not updating when file is swapped out 6 55
importing users to Security group 2 50
AutoHotkey ActiveX Component Error 8 85
Need some help with powershell script 5 48
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

785 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