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:Sending form data to a text file - Ruby - Ruby-Forum
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
