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
<!DOCTYPE html>
<html>
 <head>
 <title>Test</title>
 <body>
 <form action="" method="post" accept-charset="utf-8">
 <p>
 <label for="First Name" style="width:100px;float:left">First
Name</label>
 <input type="text" name="first_name" value="" id="first_name">
 </p>
 <p>
 <label for="Last Name" style="width:100px;float:left">Last Name</label>
 <input type="text" name="last_name" value="" id="last_name">
 <p>
 <p><input type="submit" value="Continue &rarr;"></p>
 </form>

<p>Please reenter </p>


<p> Welcome #{first_name} #{last_name}.
</body>


</html>
HTML

-- 
Posted via http://www.ruby-forum.com/.