pass parameters on a redirct

J

JoeyP

The client presses a submit button.

The path goes to a .cgi script that gathers the form params.

How can I pass those parameter onto another page?

EX.
#!/usr/bin/ruby
# *-ruby-*-
require 'cgi'
cgi = CGI.new

def redirect( new_page )
print "Location:#{new_page}\n\n"
end

all_params = cgi.params


if ( !all_params.include? 'select')
redirect('selectPage.rhtml')
else
redirect('genPage.rhtml')
end

How do I pass 'all_params' to page I'm redirecting to?

Thanks
 
V

Vlad Ciubotariu

You must save them in the user's session. Rails has this it's called the
flash, temporary storage between two pages.

I were you I would really consider ruby on rails for web programming, it's
not a steep learning curve and you solve your problems with much fewer
lines of code.

vlad
 
J

JoeyP

You must save them in the user's session. Rails has this it's called the
flash, temporary storage between two pages.

I were you I would really consider ruby on rails for web programming, it's
not a steep learning curve and you solve your problems with much fewer
lines of code.

vlad













- Show quoted text -

Thanks a bunch. I thought that that was what I was looking at.
 
A

ara.t.howard

The client presses a submit button.

The path goes to a .cgi script that gathers the form params.

How can I pass those parameter onto another page?

EX.
#!/usr/bin/ruby
# *-ruby-*-
require 'cgi'
cgi = CGI.new

def redirect( new_page )
print "Location:#{new_page}\n\n"
end

all_params = cgi.params


if ( !all_params.include? 'select')
redirect('selectPage.rhtml')
else
redirect('genPage.rhtml')
end

How do I pass 'all_params' to page I'm redirecting to?

Thanks


harp:~ > cat a.rb
require 'cgi'

class Hash
def query
map{|k,v| [CGI.escape(k), CGI.escape(v)].join('=')}.join('&')
end
end

cgi = CGI.new

def redirect( new_page , params)
print "Location:#{ new_page }?#{ params.query }\n\n"
end

if ( !all_params.include? 'select')
redirect('selectPage.rhtml', cgi.params)
else
redirect('genPage.rhtml', cgi.params)
end

-a
 
J

JoeyP

The client presses a submit button.
The path goes to a .cgi script that gathers the form params.
How can I pass those parameter onto another page?
EX.
#!/usr/bin/ruby
# *-ruby-*-
require 'cgi'
cgi = CGI.new
def redirect( new_page )
print "Location:#{new_page}\n\n"
end
all_params = cgi.params
if ( !all_params.include? 'select')
redirect('selectPage.rhtml')
else
redirect('genPage.rhtml')
end
How do I pass 'all_params' to page I'm redirecting to?

harp:~ > cat a.rb
require 'cgi'

class Hash
def query
map{|k,v| [CGI.escape(k), CGI.escape(v)].join('=')}.join('&')
end
end

cgi = CGI.new

def redirect( new_page , params)
print "Location:#{ new_page }?#{ params.query }\n\n"
end

if ( !all_params.include? 'select')
redirect('selectPage.rhtml', cgi.params)
else
redirect('genPage.rhtml', cgi.params)
end

-a
--
be kind whenever possible... it is always possible.
- the dalai lama- Hide quoted text -

- Show quoted text -

I'm not familiar with 'harp:~ > cat a.rb '
can you expand?

Thanks
 
A

ara.t.howard

harp:~ > cat a.rb
require 'cgi'

class Hash
def query
map{|k,v| [CGI.escape(k), CGI.escape(v)].join('=')}.join('&')
end
end

cgi = CGI.new

def redirect( new_page , params)
print "Location:#{ new_page }?#{ params.query }\n\n"
end

if ( !all_params.include? 'select')
redirect('selectPage.rhtml', cgi.params)
else
redirect('genPage.rhtml', cgi.params)
end

-a
--
be kind whenever possible... it is always possible.
- the dalai lama- Hide quoted text -

- Show quoted text -

I'm not familiar with 'harp:~ > cat a.rb '
can you expand?

??

that's just my prompt

-a
 

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,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top