Is name set in cgi : CGI Form « CGI « Ruby






Is name set in cgi


<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.has_key?('name') # true 
cgi.has_key?('age') # false 

 








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.Get value from a form
4.Post a message