Why doesn't this work? (CGI)

Using eruby/mod_ruby on an apache webserver. In the following code, I would expect to see both

"Hello World" and "val"

but I only get hello world. Why is that?

<html><head></head><body>
<form name=test action="test.rhtml?key=val" method=post>
<input type=hidden name=testA value="Hello World">
<%
    cgi = CGI.new
    puts cgi['testA']
    puts cgi['key']
%>
<input type=submit val="Submit">
</body></html>

···

_________________________________________________________________
MSN 9 Dial-up Internet Access fights spam and pop-ups – now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/

Orion Hunter wrote:

Using eruby/mod_ruby on an apache webserver. In the following code, I would expect to see both

"Hello World" and "val"

but I only get hello world. Why is that?

<html><head></head><body>
<form name=test action="test.rhtml?key=val" method=post>
<input type=hidden name=testA value="Hello World">
<%
   cgi = CGI.new
   puts cgi['testA']
   puts cgi['key']
%>
<input type=submit val="Submit">
</body></html>

I don't know the internals of the CGI module well, but you're mixing a query string and a HTTP POST. Does it work if you change method=post to method="GET"?

I'm sure there's a way to get both the query string and the posted variables out, though you might need to do some manual parsing of the query string. In general though, you shouldn't be mixing query string arguments and POSTs.

Ben