Pass value from a form to CGI scropt
#!/usr/bin/ruby
require 'cgi'
cgi = CGI.new
from = cgi['from'].to_i
to = cgi['to'].to_i
number = rand(to-from+1) + from
puts cgi.header
puts "<html><body>#{number}</body></html>"
An associated, but basic, form that could send the correct data would have HTML:
<form method="POST" action="http://www.example.com/test.cgi">
For a number between
<input type="text" name="from" value="" /> and
<input type="text" name="to" value="" />
<input type="submit" value="Click here!" />
</form>
Related examples in the same category