Create a Page in HTML for Accepting the Customer Information : CGI Form « CGI « Ruby






Create a Page in HTML for Accepting the Customer Information


<HTML>
<Head>
<Title>Form Data</Title>
</Head>
<Body bgcolor=yellow>
<Pre>
<Center><H1><u>Form Data </u></H1></Center>
<b><Form name=" frm1" action=" cgi_action.rb">
Name         <input type=text name=" Name">
Age          <input type=text name=" Age">
Address      <input type=textarea name=" Address">
Sex          M <Input type=radio name=" Sex">    F <Input type=radio
name=" Sex">
E-mail address       <input type=text name=" E-mail">
             <Input type=" submit" Name=" Submit" value=" SUBMIT">

</b></Form></Pre>
</Body>
</HTML>

Create a CGI Script that Will Display the Form Values

#! /ruby/bin/ruby
require 'cgi'
print "Content-type: text/html\r\n\r\n"
cgi=CGI.new
print "Name = "
print cgi[?Name']
print "<br>"
print "<br>"
print "Age = "
print cgi[?Age']
print "<br>"
print "<br>"
print "Address = "
print cgi[?Address']
print "<br>"
print "<br>"
print "Sex = "
print cgi[?Sex']
print "<br>"
print "<br>"
print "E-mail Address = "
print cgi[?E-mail']

 








Related examples in the same category

1.Pass value from a form to CGI scropt
2.Get value from a form
3.Is name set in cgi
4.Post a message