[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: passing values to your script



Adam Witney wrote:
> 
> Hello,
> 
> I am new to perl and i am not sure if this is an HTML question or a perl
> question, so i apologise if i am asking this question in the wrong forum.

Actually it's a cgi question.

> I am trying to create a web page with a list of links, each of the links
> calls the same perl script but using a different value specific to the
> link. Basically i am trying to avoid writing 30 html files for the links
> individually and instead want to use the script to generate the required
> HTML file automatically, using fields read from a tab delimited file.
> 
> The question i have is what is the best way...if indeed there is a way at
> all (!) ... to get a value from the html link into the perl script?

Absolutely. Just add the values to the end of your url:

	http://www.your_domain/your_script.cgi?name=value

For multiple values:

	http://www.your_domain/your_script.cgi?name=value&name_2=value_2

If you are going to use special characters in your names or values they must
be url encoded. That would be the "%" character followed by the hex value of
the character. For example, to pass the space character to your script:

	name with spaces

would become:

	name%20with%20spaces

Also, I should add that your script must accept argv's via the GET method as
opposed to POST.

> Dr Adam Witney,
> Malaria Program,
> Naval Medical Research Center,
> 12300 Washington Avenue,
> Rockville, MD 20852
> 
> Tel: 301 295 1821
> Fax: 301 295 6171

-- 
Scott

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch