Brian Gaber wrote:
> Using $q was not successful.
That's because you ignored my advice :)
> Here is what I have done:
>
> use vars qw($q);
That makes $q a global. Bad, bad, very bad. Slap yourself on the wrist. Remove
that "use vars" line.
> $q = CGI->new();
Now replace that with
my $q = CGI->new();
> sub print_form {
> my $dept2show = 'A';
>
> if ( $q->param('deptLtr') ) {
> ($dept2show) = $q->param('deptLtr') =~ /^([a-zA-Z]{1})$/;
> }
>
>
> I am running this script simultaneously on two PCs. Sometimes
> $dept2show has the expected value, but often is has the an old value.
This is because Apache is using multiple processes to handle things. Sometimes
you're hitting a process for the first time, so it creates an new CGI object and
all is well. But sometimes your request goes back to a process that has already
loaded and executed this code before, so $q is not a new CGI object.
--
Michael Peters
Plus Three, LP