tags:

views:

191

answers:

1

Hello everyone!

I am trying to pass arguments to this CGI form (http://www.westegg.com/inflation/) through the URL, so I don't have to manually type them in, and so that I can generate URLs through other means for faster use.

Here is the CGI form code from the site:

<form action="infl.cgi" method="post">

Enter the amount of money: <input name="money" type="text" size="9">

<p>

Enter the initial year (1800-2008): 
<input name="first" type="text" size="4" maxlength="4">

<p>

Enter the final year (1800-2008):
<input name="final" type="text" size="4" maxlength="4" value="2007">

<p>
<center>

    <input type="submit" value="Submit">
</center>
</form>

I've tried passing arguments via the "?" and "&" syntax, but none of these work:

http://www.westegg.com/inflation/infl.cgi?money=1&amp;first=1800&amp;last=1900
http://www.westegg.com/inflation/infl.cgi?money="1.00"&amp;first="1800"&amp;last="1900"

Thanks for your help :)

+2  A: 

Notice that the form uses the POST method, not GET. It's impossible to just pass the arguments in the URL. There's a lot of information out there how POST works.

adamse
Ah, I thought POST might be a problem. Sorry, I am unfamiliar with CGI :( So it is simply impossible to pass arguments through the URL then? How does the POST method work differently from GET?
VMDX
You should easily be able to find information regarding how the HTTP protocol (including how GET and POST differ) works through Google!
adamse
To use a GET all you need to do is pass options through the URL, to use a POST you need to pass the data through the HTTP header of the request. You would therefore need to build your own http requests in code or use a framework to do that for you.
ridecar2
...for some value of "impossible". The back-end code can be written to recognize both URL and body parameters/arguments, but that generally takes a bit of extra effort as most interfaces to cgi will default to ignoring URL params if a request body is present. So don't expect arbitrary third-party sites to let you mix-and-match; they're probably not making the effort to allow it.
Dave Sherohman