Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute CGI through HTML's HREF link

Tags:

html

cgi

perl

web

I want to create a HTML link. Such that when a link is clicked a CGI-script will be executed instead. That CGI script will take a parameter also.

I'm thinking of doing something like this:

<a href="./cgi-bin/run_script.cgi $param">Query</a>

Is there a right way to do it?

What I'm trying to do is to have a page that contain many words. When a word is clicked, a CGI script will be executed.

like image 709
neversaint Avatar asked Feb 05 '26 07:02

neversaint


1 Answers

The right way would be:

<a href="./cgi-bin/run_script.cgi?param=value">Query</a>

To fetch the value of the parameter in your Perl script:

use CGI;
my $cgi = CGI->new();
my $param = $cgi->param('param');
like image 159
Eugene Yarmash Avatar answered Feb 07 '26 22:02

Eugene Yarmash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!