Hi all,
   Many thanks to all who wrote about the static variable.  I now know a
lot more about cgi than I knew a few days ago!

   In the interest of keeping my code simple, I would like to take user
input from a textfield and remember it to use it in database calls on
successive pages.  L. Stein's book examples indicate this is possible using
hidden fields.  CGI Programming in Perl indicates in a paragraph that this
might or might not be a way to go.  I fiddled with the first module of my
application and got it to work.  The same solution in module 1 is not
working in module 2.
   To encapsulate my code gives something that looks like this:

    $pageName=param(-name=>'go');
    print table (...
                  TR( td(textfield(-name=>'fubar')
                 ) if $pageName eq 'INIT'
    $fubar = param(-name=>'fubar') if ($pageName eq 'Detail') or
                                       ($pageName eq 'Next').

     print submit(-name = 'go', label = 'Detail');
     print submit(-name = ;go,  label = 'Next');
Acually, the user is on a page labelled 'INIT' , which has the textfield in
it, when 'Detail' is pushed and on a page labelled 'Detail' or 'Next' when
the Next button is pushed.

     When the Detail button is pushed, $fubar correctly has what the user
typed in.  When the Next button is pushed, $fubar is undefined.
On my previous module, I was able to make these fields persist by doing a
print hidden statement on each page.  As in this example, the fields only
showed up on the screen in the first page INIT.  However, no combination of
print hidden statements, override values, hidden fields with new names
which do nothing but carry these values to  succeeding   pages has worked
to do this simple task shown in the examples in Lincoln Stein's book!

      I can always stash the values in a temporary field in the database ...

thanks,
mary                                 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to