Erupy with action and post


(Manfred Hansen) #1

Hello,

File: eingabe.erb

eruby test


Second File: start1.erb

eruby test

<% print suchen %>

The apache server get’s an "Interanl Server Error"
My message in error_log:

[Tue Jun 18 15:27:50 2002] [error] mod_ruby: error in ruby
/tmp/start1.erb.8281.0:9: undefined local variable or method suchen' for #<Object:0x407bdd18> (NameError) from /etc/httpd/ruby/eruby-run.rb:109:inload’
from /etc/httpd/ruby/eruby-run.rb:109:in run' from /etc/httpd/ruby/eruby-run.rb:77:inhandler’
from ruby:0

How can i get the variable “suchen” ?

Manfred Hansen


(Sean Chittenden) #2

File: eingabe.erb

[snip]

<form action="start1.erb" method="post" enctype="multipart/form-data"
target="anzeige_style">
    <table>
      <tr>
        <td><input type="text" name="suchen" size=15 maxlength=40> </td>
        <td><input type="submit" name="OK" value="OK"> </td>
      </tr>
    </table>
    </form>

[snip]

Second File: start1.erb

[snip]

<p>

<%

require 'cgi'
cgi = CGI.new()
suchen = cgi['suchen']
print suchen

%>

</p>

-sc

···

--
Sean Chittenden


(Manfred Hansen) #3

Hello,

require 'cgi’
cgi = CGI.new()
suchen = cgi[‘suchen’]
print suchen

%>

only this run for me

<%
require 'cgi’
cgi = CGI.new()
suchen = cgi[‘suchen’].first
print suchen.read
%>

Manfred Hansen


(Sean Chittenden) #4

> require 'cgi'
> cgi = CGI.new()
> suchen = cgi['suchen']
> print suchen
>
> %>

only this run for me

<%
require 'cgi'
cgi = CGI.new()
suchen = cgi['suchen'].first
print suchen.read
%>

Ahh. yeah, brain-o, sorry. CGI#[] returns an array, not a string.

require 'cgi'
cgi = CGI.new()
suchen = cgi['suchen'].to_s
print suchen

-sc

···

--
Sean Chittenden