Receivein a Post Attribute

I

Ivan Rodriguez

Hi!

This should be quite easy but I can't for the life of me find a
solution.

I have the following form:

<form name="input" action="Main.rb" method="post">
Url to examine: <input type="text" name="url"/>
<input type="submit" value="analyzeUrl" />
</form>

As you see the action taken when the button is pressed involves a ruby
file "Main.rb".

The Apache-server has no problem interpreting the file. The problem is
how do I pass along the text written in the textfield.

I'm guessing I need to retrieve the text in Main.rb I've failed
miserably at that.

Main.rb contains only:

ARGV.each do|a|
puts "#{a}";
end

But the only time it writes out anything is when I manually send
Main.rb?some_parameter. Then the printout will be "some_parameter".


Summary:
How do I retrieve the text from the text field in Ruby?


Thanks in advance
...And sorry if this already has been answered. I did searched.
 
Q

Quintus

Am 16.02.2011 16:41, schrieb Ivan Rodriguez:
Hi!

This should be quite easy but I can't for the life of me find a
solution.

I have the following form:

<form name="input" action="Main.rb" method="post">
Url to examine: <input type="text" name="url"/>
<input type="submit" value="analyzeUrl" />
</form>

As you see the action taken when the button is pressed involves a ruby
file "Main.rb".

The Apache-server has no problem interpreting the file. The problem is
how do I pass along the text written in the textfield.

I'm guessing I need to retrieve the text in Main.rb I've failed
miserably at that.

Main.rb contains only:

ARGV.each do|a|
puts "#{a}";
end

But the only time it writes out anything is when I manually send
Main.rb?some_parameter. Then the printout will be "some_parameter".


Summary:
How do I retrieve the text from the text field in Ruby?


Thanks in advance
...And sorry if this already has been answered. I did searched.

This is the Ruby mailing list, not the Rails one. Rails may be written
in Ruby, but they have their own forum:
http://www.ruby-forum.com/forum/rails

You're likely to get more answers there.

Vale,
Marvin
 
B

Ben Bleything

Am 16.02.2011 16:41, schrieb Ivan Rodriguez:
=20
This is the Ruby mailing list, not the Rails one. Rails may be written
in Ruby, but they have their own forum:
http://www.ruby-forum.com/forum/rails
=20
You're likely to get more answers there.

Except this isn't a rails question at all.

Ivan: you may want to look into the CGI module, which should abstract most o=
f this stuff away and make it easier to do what you're trying to do.


Ben=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top