Link to cgi program without form


Is it possible to have a standard link on an html page that links to a cgi program but passes a fixed value to the cgi program without using a form textbox and a submit button?

If so, what is the syntax?

More details:

I have cgi prog. that outputs a large html table from a database, for each record in the table there is more information which I wish to link to. This extra info. is also in the DB so another cgi prog. is required to return the data as a screen full of html. There are too many records to write a CGI prog. for each, so I want one program that is linked to by all the records but each passes it a unique record number so it knows which record to output in detail.

Thanks in advance

Who is Participating?
TheMadManiacConnect With a Mentor Commented:
welp i'll answer then :)

The thing with a form is that you dont see the long url.. and that some browsers/servers have problems with too long urls. However, they work the same way in the end.

Also, in a form the values are automatically URL encoded (which can be nice)

However, that was not the question :-)

I'm NOT really an expert at this, but I think something like

<a href="'myvalue'">

would work.  I have seen similar constructs a number of times.  I've just never done it myself.


Actually, the URL you would give would be without the single quotes

<A HREF="cgi-program?param1name=param1value&param2name=param2value">My link to a cgi program with parameters!</A>

This should work. However, some cgi programs make a distinction between a GET and a POST (this is a GET).

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Don't forget to properly URL-escape the query string (that's
everything past the question-mark).
andyknottAuthor Commented:
Thanks very much, thats exactly what I wanted and it works fine. Submit your comments as an answer and I'll grade it.

There have been comments from three of us on this.  My vote goes to theMadManiac for the points (since my original answer would probably not work).  However, I will take them, if you wish <G>.

andyknottAuthor Commented:
Hi Tom,

I'll give the grade to theMadManiac if they respond by early next week, otherwise please feel free to submit your comments as an answer.

Thanks for your efforts, I'm sure I would have worked out the exact syntax from your comment but as I didn't get back here until several comments had been added I used theMadmaniacs comment.
For technical reasons, I think it would be better form to do it through a form.  The form would have no visible fields, but instead use hidden fields to hold those default values.  That way you keep the standard of the .cgi programs and also keep control of the GET and/or POST methods.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.