CGI and re-direction

T

Toby Rodwell

I have written a simple CGI script. It loads in an object, and prints
out a few of its attributes. I would like to add some check-boxes such
that when I hit the submit button some other booleans get set, it
accesses a second CGI page, which updates the object based on the
cgi.params, and then returns to the first page so that the object can be
be re-displayed (hope that all makes sense - it's getting late!)

So my question is, how do I redirect back to the first page from the
second? Or is there another (better) way to achieve the same result
(perhaps by using just the one page)

Thanks!
 
T

Toby Rodwell

Doug said:
Just post to the same script, and have it check whether it has been
posted to, and, optionally, an action parameter (in case a previous page
posts to it) to tell it which action needs to be taken.

-Doug

Thanks for the quick reply. If I use the same script don't I have
problems using cgi.params, as on the first visit they don't exist? Or
do I use an if..then to choose between two pages (one used pre-posting
and the other post-posting(!)) As you can tell, I'm not a programmer per
se, so any examples (or pointers to examples) would be very much
appreciated.

thanks again
 
T

Toby Rodwell

[Clarification of previous post]
when I said "do I use an if..then to choose between two pages (one
used pre-posting and the other post-posting" what I meant was:


#!/bin/ruby
....

if FIRST_VISIT # (how do I test?)
cgi.out { a page not referring to cgi.params}
else
cgi.out { a page using cgi.params }
end


Or can I avoid this? Thanks!
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top