Self post method in ruby cgi

Hi
I have done php programming before… and just wondering if ruby cgi has
the capability to do the same thing as php :
example

index.rb:

#!/usr/bin/ruby
require ‘cgi’
require ‘mysql’
cgi = CGI.new

m = Mysql.new(“localhost”,“root”,"",“fosiul”)
r = m.query(“SELECT * FROM dc”)

puts cgi.header

puts "

Report

Report

"
r.each_hash do |f|
puts “<option value=#{f[‘dc’]}>#{f[‘dc’]}”
end
puts "

"

Now when i will click on submit. i want stay on the same page index.rb
but wants to get the value of SELECT.

in php i would of done thing like this

<?php if(isset($_POST['formSubmit']) ) { $varMovie = $_POST['dc']; // - - - snip - - - } else ................... .......... ?>

Can this concept be implemented here in ruby cgi ??

So basically after I click on submit, I want to stay on the same page as
index.rb and if page has a post value it will give the value …

Can it be done ??

Thanks

Can this concept be implemented here in ruby cgi ??

if cgi.params()[“formSubmit”].empty?
#do something
else
#do something else

Thanks