In the code you sent along you had misspelled the ACTION parameter in the
form tag. (ACTON)
If that is true the page will call itself and cause the nuisance.

=)

/Andréas Skoglund

On Tue, 12 Jun 2001, Kris Cook wrote:

> Well, I did note that I had omitted the METHOD="POST" statement.  However,
> that didn't fix it.  Oddly, adding a text field to the form solved the
> problem.  I know that isn't necessary by HTML standards, so I am once again
> scrutinizing Personal Web Server as the potential culprit.  Since I did need
> to add a couple of optioinal fields to that page in the future anyway, the
> quirk isn't THAT annoying, just a minor nuisance.
> 
> I know.  REAL web programmers use Apache.  Unfortunately, most of my
> customers run IIS, so I try to run on PWS (Pretty Weak S***? Pathetic Weenie
> Server?) since it most closely approximates.  I now have a Win2k platform at
> home with IIS running, so I can test in a better environment.
> 
> BTW: In the future, try to use Reply to All to reply to the list, so others
> on the [EMAIL PROTECTED] list can benefit from the suggestions.
> 
> > -----Original Message-----
> > From: Howdy! [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, June 11, 2001 9:00 PM
> > To: Kris Cook
> > Subject: Re: Circular reference
> > 
> > 
> > Kris,
> > 
> > ----- Original Message -----
> > 
> > > Actually, this is the code for Validate.pl.  Validate looks up the
> > username
> > > and password, and if it's not found, gives the user the 
> > chance to hit the
> > > Back button and re-enter.  On Continue, it sets the name of 
> > the menu to
> > > load, and goes forward to StargPage.pl, wihch simply sets 
> > up a frames page
> > > with the appropriate menu in the left frame.
> > >
> > > StartPage.pl DOES INDEED receive $nextnav.  If I set up a 
> > simple form to
> > > create the hidden field and call StartPage.pl, it  works: 
> > but, when it's
> > > done from Validate.pl, it re-enters Validate.pl instead of calling
> > > StartPage.pl.  Most odd.
> > >
> > > Also, this is just the prototype of the finished product.  
> > It DOES need to
> > > be a form, eventually.   Eventually, there will be one-way 
> > encryption on
> > the
> > > password, and it will be compared to a stored, encrypted 
> > password.  So,
> > what
> > > I neeed is a way to validate the pairs, give the user a 
> > choice of going
> > back
> > > or going forward, and passing the appropriate menu name to the next
> > program.
> > 
> > Okay, so I copied your code and reformatted it using more 
> > CGI.pm calls to
> > run a test.  I also created a StartPage.pl to receive 
> > Validate.pl's input.
> > Everything works fine. Which leads me to wonder if your form 
> > method is using
> > GET instead of POST.  Check that and here is the code I 
> > mocked up which
> > works fine:
> > 
> > -- Validate.pl --
> > #!/perl/bin/perl
> > 
> > use CGI qw(:standard);
> > use strict;
> > 
> > my $userid = param('userid');
> > my $passwd = param('passwd');
> > 
> > # Verify name and password here
> > 
> > # If validated okay
> > my $welcome_validated = "Welcome $userid!  Good to seeya! 
> > Click Continue to
> > go on.";
> > my $nextnav_validated = "AdminMenu.htm";
> > 
> > # If not validated okay
> > my $welcome_not_validated = "Sorry, $userid, but I don't find 
> > a matching
> > password.<BR>\n".
> >          "I'll have to send you in as a user, or you can click on your
> > browser's<BR>\n".
> >          "<STRONG>Back</STRONG> button and try again.<BR>";
> > my $nextnav_not_validated = "VisitorMenu.htm";
> > 
> > print
> >     header, start_html, br,
> > 
> >     "$welcome_validated\n",
> >     start_form(-action=>'StartPage.pl'),
> >     hidden(-name=>'nextnav',-value=>"$nextnav_validated"),
> >     p,
> >     submit(-name=>'Continue'),
> >     end_form,"\n\n",
> > 
> >     hr,
> > 
> >     "$welcome_not_validated\n",
> >     start_form(-action=>'StartPage.pl'),
> >     hidden(-name=>'nextnav',-value=>"$nextnav_not_validated"),
> >     p,
> >     submit(-name=>'Continue'),
> >     end_form,
> > 
> >     end_html;
> > 
> > -- StartPage.pl --
> > #!/perl/bin/perl
> > 
> > use CGI qw(:standard);
> > use strict;
> > 
> > my $nextnav = param('nextnav');
> > 
> > print
> >     header,
> >     start_html,
> >     "You chose [$nextnav]",
> >     end_html;
> > 
> > Hope it helps!!!
> > Joel
> > 
> > > > -----Original Message-----
> > > > From: Howdy! [mailto:[EMAIL PROTECTED]]
> > > > Sent: Saturday, June 09, 2001 11:11 AM
> > > > To: Kris Cook
> > > > Subject: Re: Circular reference
> > > >
> > > >
> > > > << Regarding: Circular reference, Kris Cook said >>
> > > >
> > > >
> > > > > I wrote a Perl script that receives a trio of parameters
> > > > (DSN, user ID and
> > > > > password), and validates that the UserID and Passwd match a
> > > > pair in the
> > > > > database.  It then displays a message based on whether you
> > > > validated, and
> > > > > gves you a continue button.  This seems to work fine, but
> > > > when you click
> > > > on
> > > > > continue, instead of going to the next page, it re-enters
> > > > the same Perl
> > > > > script!  Of course, this time it hasn't prepared the
> > > > parameters, so now it
> > > > > DOESN'T find the right information.  I am extremely confused.
> > > > >
> > > > > The code is below:
> > > >
> > > > << Snipped Code  >>
> > > >
> > > > > my $cgi        = new CGI;
> > > > > my $dsn        = $cgi->param('DSN');
> > > > > my $ODBCString = "DSN=".$dsn.";";
> > > > > print "Content-type: text/html\n\n";
> > > > >
> > > > > my $userid     = $cgi->param('userid');
> > > > > my $passwd     = $cgi->param('passwd');
> > > >
> > > > << Snipped Code  >>
> > > >
> > > > > if ($db->FetchRow) {
> > > > >    my %Data;
> > > > >    undef %Data;
> > > > >    %Data = $db->DataHash();
> > > > >    my $found;
> > > > >    my $item;
> > > > >    my $value;
> > > > >    while (($item,$value) = each(%Data))
> > > > >    {
> > > > >       $found = $value;
> > > > >    }
> > > > >    if ($found)
> > > > >    {
> > > > >       $welcome = "Welcome ".$userid."!  Good to seeya!
> > > > Click Continue to
> > > > go
> > > > > on.";
> > > > >       $nextnav = "AdminMenu.htm";
> > > > >    }
> > > > >    else
> > > > >    {
> > > > >       $welcome = "Sorry, ".$userid.", but I don\'t find 
> > a matching
> > > > > password.<BR>\n".
> > > > >                  "I\'ll have to send you in as a user, or
> > > > you can click on
> > > > > your browser\'s<BR>\n".
> > > > >                  "<STRONG>Back</STRONG> button and try 
> > again.<BR>";
> > > > >       $nextnav = "VisitorMenu.htm";
> > > > >    }
> > > > > }
> > > > > print <<EOF;
> > > > >          <BR>
> > > > >          $welcome
> > > > >          <FORM ACTON="http://localhost/scripts/StartPage.pl";>
> > > > >          <INPUT TYPE="hidden" NAME="nextnav" VALUE="$nextnav">
> > > > >          <P>
> > > > >          <INPUT TYPE="submit" VALUE="Continue">
> > > > >       </FORM>
> > > > >    </BODY>
> > > > > </HTML>
> > > > > EOF
> > > >
> > > > The ACTION part of your FORM tag is telling it to go to
> > > > StartPage.pl which I
> > > > assume is the code you've included.  You have $nextnav tucked
> > > > into a hidden
> > > > form field for which StartPage.pl is not using.
> > > >
> > > > It looks like you don't need a form here at all.  Either make
> > > > a hyperlink
> > > > for the
> > > > 'Continue' with the right $nextnav like:  <a
> > > > href=$nextnav>Continue</a> OR
> > > > use a button with javascript to go to the right page like:
> > > > <INPUT TYPE=BUTTON VALUE='Continue'
> > > > ONCLICK="Javascript:document.location.href='$nextnav' "> OR
> > > > Cgi.pm style: print
> > > > $cgi->button(-name=>'Continue',-onClick=>"Javascript:document.
> > > > location.href=
> > > > '$nextnav' ");
> > > >
> > > > Hope that helps!
> > > >
> > > > Joel
> > > >
> > > >
> > >
> > >
> > 
> > 
> 

Reply via email to