Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a variable

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I have a link on a web page that says "HELLO"

When the user clicks on this, I want it to start a cgi but the cgi needs to know what the words are in the link the user clicked.

Does anyone know how to do this? How do I pass that to the cgi?

Thanks
 
make the link just a little smarter.....

Instead of...
Code:
<a href=&quot;[URL unfurl="true"]http://www.yourserver.com/cgi-bin/your.cgi&quot;>Hello</a>[/URL]


Use
Code:
<a href=&quot;[URL unfurl="true"]http://www.yourserver.com/cgi-bin/your.cgi?do=Hello&quot;>Hello</a>[/URL]

Then, in your CGI code, the 'do' form var will contain 'Hello'.
You must allow for the 'GET' method in your CGI. If you are using CGI.pm, it handles that for you.

#!/usr/local/bin/perl
use CGI;
my $cgi = new CGI;
$doWhat = $cgi->param('do');


HTH





keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top