Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Forms
Harry Sa
2/11/2008 6:18:00 PM
Hi. I'm new here, and new at programming Ruby. I have a question about
it though.
Is there a possible way to write forms in HTML, and then read them using
a Ruby equivalent to the PHP $_GET or $_POST on the page where the
method points?
--
Posted via
http://www.ruby-...
.
2 Answers
Jim Clark
2/11/2008 6:42:00 PM
0
Harry Sa wrote:
> Is there a possible way to write forms in HTML, and then read them using
> a Ruby equivalent to the PHP $_GET or $_POST on the page where the
> method points?
>
Check out Ruby's CGI library at
http://www.ruby-doc.org/stdlib/libdoc/cgi/rdoc/...
.
HTH,
Jim
David Moreno
2/11/2008 10:20:00 PM
0
[Note: parts of this message were removed to make it a legal post.]
Yes, there is.
On your ruby application endpoint, you would need something like this:
require "cgi"
cgi = CGI.new
value = cgi['field_name'] # <== value string for 'field_name'
And do all sorts of Ruby operations:
# if not 'field_name' included, then return "".
fields = cgi.keys # <== array of field names
# returns true if form has 'field_name'
cgi.has_key?('field_name')
cgi.has_key?('field_name')
cgi.include?('field_name')
On the same scoop of concept you were viewing it, cgi['field_name'] it's
kind of the same as PHP's $_REQUEST['field_name'].
Actually, I extracted that sample above from the cgi module documentation
somebody else already pointed to you.
Enjoy,
D.
On Feb 11, 2008 1:17 PM, Harry Sa <rule.brittania@hotmail.co.uk> wrote:
> Hi. I'm new here, and new at programming Ruby. I have a question about
> it though.
>
> Is there a possible way to write forms in HTML, and then read them using
> a Ruby equivalent to the PHP $_GET or $_POST on the page where the
> method points?
> --
> Posted via
http://www.ruby-...
.
>
>
--
David Moreno -
http://www....
Yes, you can.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Forms
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password