CGI: Run Script then load page

Cliff Crawford cjc26 at nospam.cornell.edu
Tue Aug 7 11:30:21 EDT 2001


* Lang <bob at tharin.com> menulis:
| 
| In short, does anyone know how to submit data to a script, have the
| script run, and then load another page with the values still intact
| with no user interaction (other than the first click)?  Thanks again.

A simple way would be to do the following in your first script:

    print "Location: new_script.py?year=%s&month=%s&day=%s\n\n" \
                                    % (year, month, day)

(IOW just pass the values you need as a GET request in your redirect)
But if you're doing anything more complicated than that you'll probably
want a session management library of some sort.  The basic idea is that
you generate a unique ID for each user when they log in, and store this
ID on the client as a cookie (so that the ID gets sent back to you on
every request); then, on the server store/retrieve whatever variables
you need in a database under the ID.


-- 
Cliff Crawford                           http://www.sowrong.org/
"Today's Goths, who generally tend to be in their teens and 20s,
have nothing to do with the Germanic Visigoths of Europe in the
third and fourth centuries A.D."               -- Jimmy Stewart



More information about the Python-list mailing list