473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Passing variable in a hyperlink to a Perl script

I am creating a web site where I want to have a hyperlink that executes a Perl script. At the same time, I want to pass along a variable inside of the hyperlink that the Perl script can use when it executes.

I don't want to use a form unless it is necessary.

The hyperlink might look like this:

<a href=get_info.pl?variable="chicken">I like fried chicken</a>

So, when the user clicks on the link, the Perl script named "get_info.pl" would know that the variable equals "chicken".

Any suggestions or tips are appreciated.

Thanks,

Tony
Aug 24 '07 #1
5 5110
KevinADC
4,059 Expert 2GB
use the CGI module to parse the query string:

perldoc: CGI module
Aug 24 '07 #2
I understand that I need to use the CGI module, but what I am looking to do is to create a hyperlink that executes a Perl script.

Currently, if I have a hyperlink like this:

<a href=get_invoice.pl>Get Invoice</a>

the output is nothing but the Perl script as text. The script doesn't get executed.

Thanks
Aug 25 '07 #3
numberwhun
3,509 Expert Mod 2GB
I am not really sure you can do that. Hyperlinks are supposed to be links to other pages or documents.

One thing you could do is create a quick, small form, maybe just a button, that says "Display Invoice" and when the button is clicked, the invoice is displayed.

Regards,

Jeff
Aug 25 '07 #4
KevinADC
4,059 Expert 2GB
hyper links can execute scripts, just include the correct url:

<a href="cgi-bi/get_invoice.pl">Get Invoice</a>

if the script displays instead of executing you are using it in the wrong folder or the server is not setup corectly.
Aug 25 '07 #5
My problem was that I wasn't putting this in the script to tell the browser to expect html...

print "Content-type: text/html\n\n<html>";

Thanks.
Aug 26 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
3
by: stahl.karl | last post by:
I have a CGI/Perl program that returns a string output. Is it possible to get this into a Javascript variable, where the name of the variable is defined in the Javascript and not in the Perl code?...
1
by: thumbiko | last post by:
I read some discussion on this topic however I am faced with the same problem of passing a php variable into a perl script. I want to pass a string from a php script to a perl script which is called...
6
by: roop1 | last post by:
Hello gits, I found this snippet that you offered to another person and I was wondering if it wouldn't work for me as well: <script type="text/javascript"> function...
23
by: smarsh | last post by:
Hi, Someone put together a small perl script for me that uses day and time to determine which of two images to display (open.gif or closed.gif). I need to modify the script to also include a...
1
by: abertay | last post by:
Hi friends...I need our help.I'm stuck with this code... can some one tell me how can pass a javascript variable into hyperlink along with a php varaible? Here is my code.. <html> <head>...
1
by: satish2112 | last post by:
Hi, I have a text-area which contains values from mysql database and 2 buttons, Edit and Update. When I click on the Edit button, I can edit the text-area (initially non-editable). After this,...
4
by: sonu2die4 | last post by:
Hi, I have the following perl script working for me.I am accesing the database from my perl script using use Net::Telnet(); package. I am not using DBI package.as I stated earlier the following...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.