I a new to Ruby and CGI scripts. I have developed a test CGI script to
collect a first and last name. I would like to echo the first and last
name if it is submitted correctly or prompt user to reenter if that is
not the case.
This is what I have so far:
#!/usr/local/bin/ruby
require ‘cgi’
cgi = CGI.new
first = cgi[‘first_name’]
last = cgi[‘last_name’]
puts “Content-type: text/html”
puts
puts <<HTML
TestFirst Name
Last Name
Please reenter
Welcome #{first} #{last}. HTML
Latest change to include conditional statement:
#!/usr/local/bin/ruby
require ‘cgi’
cgi = CGI.new
first = cgi[‘first_name’]
last = cgi[‘last_name’]
puts “Content-type: text/html”
puts
puts <<HTML
TestFirst Name
Last Name
Please reenter
Welcome #{first} #{last`}.
HTML