From: jthorne@... Date: 2002-10-08T07:45:51+09:00 Subject: Re: eruby forms processing Bruce, Thanks for the help...I was treated the CGI params as a simple hash...your advice has helped a lot... Cheers Jeff -----Original Message----- From: ruby-talk-admin@ruby-lang.org [mailto:ruby-talk-admin@ruby-lang.org] On Behalf Of Bruce Williams Sent: Monday, October 07, 2002 5:21 PM To: ruby-talk ML; jthorne@zixcorp.com Subject: Re: eruby forms processing On Monday 07 October 2002 03:50 pm, jthorne@zixcorp.com wrote: > I am a newbie web programmer who has been told that ruby and eruby is > far superior to ASP, etc.I am trying to figure out how to process some > simple form data with eruby.Do I need to write a CGI application or > can I process the form data with eruby similar to active server > pages.I am trying to locate some code or syntax that would allow me to > process a form with method=post.I am having some trouble tracking down > a decent tutorial... > > Thanks for the help, > Jeff Jeff, IIRC eruby doesn't automatically import the parameters (ala-PHP-- and possibly ASP [?]) in any fashion, and this is the way I've always handled it. Someone may have a better suggestion... Use the CGI library. <% require 'cgi' params = CGI.new.params %> A common 'gotcha' with cgi.rb is the fact that CGI#params is a Hash of Arrays, not just a simple Hash. In most cases to access data you'll want to something like: <%= params['foo'][0] %> Playing with cgi.rb in irb will make this apparent. Happy erubying. - Bruce -- _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ Bruce Williams http://www.codedbliss.com iusris/#ruby-lang bruce@codedbliss.com _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/