Getting user input from user on a webpage?

A

Adam Lee

Hello, I was wondering if there is a way for a ruby script to get a user
input when it's running on a webserver. I need a basic function like
where there user can click on a button on a website which will invoke a
method.
 
M

Mike Stephens

When you saying "it's running a web server", what caused it to run?
Normally you'd expect a user message (eg HTTP GET from a web page) to
trigger the script. The web server would run the script using the HTTP
variables.
 
A

Adam Lee

Mike said:
When you saying "it's running a web server", what caused it to run?
Normally you'd expect a user message (eg HTTP GET from a web page) to
trigger the script. The web server would run the script using the HTTP
variables.

Hm can you briefly show me an example how I can pass a variable to a
script using HTTP GET? I think I'm almost there with your tip!!
 
M

Mike Stephens

How you pick up what the user has typed in the web page will depend on
the server you are running. For example in the Ruby CGI class you can
ask for individual fields or access them all with CGI#params. Have a
look at the Pickaxe book which I think is now bundled with the Ruby
download.
 
A

Adam Lee

Never realized the Pickaxe book is available for free. Although there is
a new version, I think the fundamentals are the same. Thanks for the
pointer :)
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top