From: Adam Kennedy Date: 2013-01-10T04:21:06+09:00 Subject: Sending HTML form information to a text file or visitor_log The Subject says it all really. I am trying to have the information send from a simple html form to a text file or visitor_log. This is my Code: #!/media/Apache/ruby/bin/ruby #!/usr/local/bin/ruby require "cgi" cgi = CGI.new() fn = cgi.params['forename'] sn = cgi.params['surname'] em = cgi.params['email'] age = cgi.params['age'] gender = cgi.params['gender'] puts cgi.header("text/html") puts "" puts "" puts "Input request" puts "" puts "

Your name is #{fn} + #{sn}

" puts "

Your general information:
" puts "Age: #{age}
" puts "Gender: #{gender}
" puts "Email Address: #{em}

" puts "" puts "" open('media/Apache/apache2/logs/visitor_log', 'a') { |f| f.puts forename f.puts surname f.puts email f.puts age f.puts gender } The information is displayed but then nothing actually happens within the visitor_log file. The piece of code im using was originally found here:http://www.ruby-forum.com/topic/202526 And this is from my error log: [Wed Jan 09 19:13:33 2013] [error] [client 127.0.0.1] /media/Apache/apache2/cgi-bin/hello1.cgi:26:in `initialize': No such file or directory - media/Apache/apache2/logs/visitor_log (Errno::ENOENT), referer: http://localhost:10000/ [Wed Jan 09 19:13:33 2013] [error] [client 127.0.0.1] \tfrom /media/Apache/apache2/cgi-bin/hello1.cgi:26:in `open', referer: http://localhost:10000/ [Wed Jan 09 19:13:33 2013] [error] [client 127.0.0.1] \tfrom /media/Apache/apache2/cgi-bin/hello1.cgi:26:in `
', referer: http://localhost:10000/ Thanks Adam K -- Posted via http://www.ruby-forum.com/.