CGI.new Can't Get the value ?

Z

Zeuxis Lo

i use ruby to write a cgi ..
but i can not use the CGI.new to get the "sk=go" value..
who can help me to fix the problem ?

thanks

=======================
index.html :
=======================

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test</title>
</head>
<body>
<form action="test.rb?sk=go" method="post" target="skchat3"
onsubmit='window.open("","skchat3","resizable=yes,toolbar=no,directories=no,status=no,scrollbars=yes,resize=yes")'>
username : <input type="" />
password : <input type="" />
<input type="submit" value="submit" />
</form>
</body>
</html>

=======================
test.rb :
=======================

#!C:/InstantRails/ruby/bin/ruby

require 'cgi';

POST = CGI.new

print "Content-type: text/html\r\n\r\n"
print "This is a output test"
print "<br />"
print ">>"+POST['sk']
 
K

Ken Bloom

i use ruby to write a cgi ..
but i can not use the CGI.new to get the "sk=go" value.. who can help me
to fix the problem ?

It can't, because you made a POST query, so it's using the [] operator to
store POST data. If you want to access the query string, you can still do
so with CGI#query_string, but you'll have to decode it yourself.

(I use this much more simply: I have a script "testframework" that I call
as testframework?experimentname -- no name=value and encoding stuff to
parse -- and testframework has several forms that post back to itself
using the same URL)

--Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top