Click to See Complete Forum and Search --> : [RESOLVED] passing variable between scripts


yssirhc
04-15-2009, 11:30 AM
I have a log-in page that gets the user ID from the form

$submittedUser = $formHash{"user"};

Within that script there's a subroutine that prints an html page to redirect the user to the main page.

<meta http-equiv="REFRESH" content="1;url=mainPage.cgi">


I'm trying to figure out how to pass that user ID variable to the main page's script so that I can keep track of who submitted what information.
So, for example, on the main page it could then greet the user with a "Welcome, $submittedUser".

I suppose if instead of having that redirect page, I just printed the main page from within that same script for logging in, I could then use that user ID variable, but it would be better to keep the scripts separate.

Any ideas on how to do this?

winracer
04-15-2009, 03:29 PM
on the page you are on can you do a print qq~$submittedUser~; and have the user name that you want before you do the redirect?

it has been awhile and sometimes I get perl and php mixedup

<meta http-equiv="REFRESH" content="1;url=mainPage.cgi?$user=$submittedUser">


and on new page the $user varable should be the $submittedUser varable


or


<meta http-equiv="REFRESH" content="1;url=mainPage.cgi?variable=$submittedUser">



you can read up on it at http://perldoc.perl.org/CGI.html
and http://perldoc.perl.org/CGI.html#FETCHING-THE-NAMES-OF-ALL-THE-PARAMETERS-PASSED-TO-YOUR-SCRIPT%3a
hope this help

yssirhc
04-16-2009, 09:58 AM
thank you! putting it in the query string worked beautifully ! :)

winracer
04-16-2009, 10:32 AM
glad I could help