I just wanted to add that there is no direct translation of your code to ruby for two reasons:
1) In ruby, there are no tags like <?ruby ?>
2) In ruby, there is no equivalent of the php include() statement.
php was designed for the web--while ruby is a general purpose programming language that has been applied to the web. ruby can certainly retrieve form data using cgi (and with a lot cleaner syntax than in php). And in ruby you can also create something called an erb file, which can contain arbitrary text, like html, with tags interspersed in the html that contain ruby code. But you have to explicitly execute the erb file to get ruby to replace the special tags with the output of the ruby code--the server does not do that automatically like with php.