Get value from a form : CGI Form « CGI « Ruby






Get value from a form


<html> 
<head><title>Test Form</title></head> 
<body> 
I like Ruby because: 
<form target="cgibin/survey.rb"> 
<input type="checkbox" name="reason" value="flexible" /> 
It's flexible<br /> 
<input type="checkbox" name="reason" value="transparent" /> 
It's transparent<br /> 
<input type="checkbox" name="reason" value="perlish" /> 
It's like Perl<br /> 
<input type="checkbox" name="reason" value="fun" /> 
It's fun 
<p> 
Your name: <input type="text" name="name"> 
</p> 
<input type="submit"/> 
</form> 
</body> 
</html> 


# survey.rb

require 'cgi' 
cgi = CGI.new 
cgi['name'] 
cgi['reason']

 








Related examples in the same category

1.Pass value from a form to CGI scropt
2.Create a Page in HTML for Accepting the Customer Information
3.Is name set in cgi
4.Post a message