GET parameters are lost when submitting a form with POST method in CGI?
<form method="POST" action="/index?key=1">
<input type="text" name="another_key" value="2" />
<开发者_JS百科;/form>
When I submit such a form and trying to fetch the GET
parameter with CGI->new->param('key')
,
it doesn't work..
Can CGI work when both GET
and POST
parameters exist?
For a POST request, CGI's param method will only get post parameters, but there is an alternate url_param method that will provide the "GET" parameters from the url.
This can be very helpful for file uploads; if the post request is too large, it will be entirely discarded, but the url parameters can tell you what kind of upload it was so you can show the user an error message in the correct context.
精彩评论