Send Perl-Win32-Web mailing list submissions to
        [EMAIL PROTECTED]

To subscribe or unsubscribe via the World Wide Web, visit
        http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Perl-Win32-Web digest..."


Today's Topics:

  1. RE: Emailing forms w/data intact ([EMAIL PROTECTED])
  2. Cookie vs Text File For State (Purcell, Scott)

--__--__--

Message: 1
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: Emailing forms w/data intact
Date: Wed, 8 Nov 2000 17:15:29 -0600
boundary="----_=_NextPart_001_01C049D9.C8FB09C0"

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C049D9.C8FB09C0
Content-Type: text/plain;
        charset="iso-8859-1"

That's it exactly, Jonathan (the former, that is).  I want to create a
script that I can pass an HTML file to (which contains a form), have the
user fill it out, then process it enough to create a new HTML file with the
form data that the user entered.  Some forms will be filled out by
salespeople for customers.  Some forms will be emailed around to several
people for, say, approving purchase orders.  To put it another way, here is
my goal: if you looked at the resulting HTML file with a browser, the form
data would already be there.
 
I've been looking at HTML::TokeParser, HTML::Parser, and HTML::FillInForm.
 
I despise asking other people to do my work for me.  But code suggestions,
or a book recommendation, would be appreciated.
 
TIA!
-WM  <><
 
 -----Original Message-----
From: Jonathan Crowther [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 08, 2000 10:04 AM
To: 'Thomas_M'
Cc: [EMAIL PROTECTED]; '[EMAIL PROTECTED]'
Subject: RE: Emailing forms w/data intact



He said : 
    About 100 forms (in HTML files) were created by a couple of 
    interns last summer, and I'd prefer to pass the form name as part 
    of the query string 

He doesn't want to re-write all 100 forms into Perl, which is what you are
telling him to do. 

Personally, in such a situation, I would write a Perl script that I run once
that would convert all the HTML to pure Perl, and then do what you suggest,
but if he really doesn't want to use Perl natively (i.e. keep the pure HTML
files), he needs to do on-line parsing of each HTML to extract the form
elements and replace them with the submitted values.

Of course, if he doesn't care about the format of the resulting pages (i.e.
if they don't have to follow any logical visual ordering), he could just
dump the "param()" keys and values to the file, and not bother parsing the
HTML, but I don't think that's what he was asking.

William? 

Cheers, 
Jonathan 


-----Original Message----- 
From: Thomas_M [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] 
Sent: Wednesday, November 08, 2000 5:19 AM 
To: Crowther, Jonathan [ORCH:9T03-M:EXCH]; 
[EMAIL PROTECTED]; '[EMAIL PROTECTED]' 
Subject: RE: Emailing forms w/data intact 


Why would he need to do all that? Assuming he uses CGI.pm to generate the 
form, he can simply print out the form fields or the result if it exists. 

Something along the lines of: 
        if (param()) { 
                print param('name');                # print response 
        } else { 
                print textfield(-name=>'name' ...); # print form field 
        } 

or, more simply, 
        print param()? param('name') : textfield(-name=>'name'); 

and if you wanted to only print the non-blank responses: 
        print param('name') || textfield(-name=>'name'); 

-- 
Mark Thomas                    [EMAIL PROTECTED] 
Sr. Internet Architect         User Technology Associates, Inc. 

$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; 

-----Original Message----- 
From: Jonathan Crowther [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] 
Sent: Tuesday, November 07, 2000 7:14 PM 
To: [EMAIL PROTECTED]; '[EMAIL PROTECTED]' 
Subject: RE: Emailing forms w/data intact 


Given that you already have the HTML files, and you need to scan them for 
the form tags that you want to replace with the values submitted, you could 
also look at using the HTML parser to scan the HTML tags, such as the 
following: 
HTML::TreeBuilder 
HTML::Parser 
HTML::TokeParser 
HTML::Form 
HTML::Element 
I have never used these myself, but they look useful in your case. 
The methodology would be: 
1. Use CGI.pm to read the query (including for form name and key/value 
pairs) 
2. Use HTML::TreeBuilder to scan the HTML page 
3. Replace Form elements with values entered (in 1.) using 
4. Use CGI.pm and also "print $h->as_HTML" to print the HTML elements out 
5. Use Net::SMTP to send the e-mail 
Looking at this again, you may want to go with HTML::TokeParser instead of 
HTML::TreeBuilder.... any way, you can continue looking... 
Cheers, 
Jonathan 
"Joust Not with Dragons, for Thou art Crunchy, and Goode with Ketchup..." 


-----Original Message----- 
From: Cameron Dorey [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] 
Sent: Tuesday, November 07, 2000 3:34 PM 
To: [EMAIL PROTECTED] 
Subject: Re: Emailing forms w/data intact 


> [EMAIL PROTECTED] wrote: 
> 
> I want to let a user click a link which runs a Perl program, passing a 
> filename on the query string (like 
> http://www.domain.com/cgi-bin/process_form.pl?form=testform.html
<http://www.domain.com/cgi-bin/process_form.pl?form=testform.html> ). 
> Easy. 
> 
> Then, after the user fills out and submits the form, I want to combine 
> the user's responses and the form, and save it in a separate HTML 
> file. In other words, I want a file that looks just like what the user 
> filled out, with the data. Tough (?). 
> 
> Finally, I want to email that document to another party. Easy. 
> 
> I created a fairly nice script which you can place an HTML form into. 
> (You only need to insert perl variables strategically.) I'd rather not 
> create 100 similar Perl applications if I can help it. :) 
> 
> Can this be done? I think it can be using CGI.pm. 
See below, that's how I would do it. Just read your HTML file into a 
filehandle and stick the user inputs into it, then print back out. I was 
just suggesting (strongly) that as long as you are using CGI.pm (and I 
would always use CGI.pm), use it effectively, let it do the 
packing/unpacking/splitting/tr'ing, don't reinvent the wheel. 
Cameron 
> -----Original Message----- 
> From: Cameron Dorey [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] 
> Sent: Tuesday, November 07, 2000 4:26 PM 
> To: [EMAIL PROTECTED] 
> Subject: Re: Emailing forms w/data intact 
> 
> > [EMAIL PROTECTED] wrote: 
> > 
> > Can someone wind me up and point me in the right direction? 
> > 
> > I'm trying to let users submit an HTML form into a file, with data 
> > intact.  About 100 forms (in HTML files) were created by a couple of 
> 
> > interns last summer, and I'd prefer to pass the form name as part of 
> 
> > the query string (like process_form.pl?form=testform.html). 
> > 
> > I've looked at CGI.pm 
> > ( http://www.perl.com/pub/doc/manual/html/lib/CGI.html
<http://www.perl.com/pub/doc/manual/html/lib/CGI.html> ), and the 
> tools 
> > are right there, but I can't seem to piece them together. 
> > 
> > I know well how to fetch data from a submit, how to process it, how 
> to 
> > email a file, etc., and I've used Perl for about two years. It's 
> > re-inserting the data back into a form that I'm stumbling over. 
> > 
> > Here's where I'm at now, for starters. 
> > 
> > [code snipped] 
> 
> Good golly, Miss Molly, pardon me, but what are you trying to do here 
> with all those split/tr/packs? CGI.pm lets you work with forms without 
> 
> having to do all the splitting yourself, it's all in the docs. 
> Basically, your parameters are from the form itself and you just pull 
> them out by a statement like: 
> 
> $client_name = $cgi->param(name); 
> 
> for all your fields. 
> 
> Now, I'm not exactly sure what you want to save, is it the filled-out 
> form with the user inputs in boxes exactly like the user would see 
> them? 
> the filled-out form with the user inputs looking like they were part 
> of 
> the form text? Whichever way, probably the easiest way I can think of 
> to 
> save them is to print your form to a file as a "here document" putting 
> 
> the variables in at the appropriate places, such as (just cobbled up 
> on 
> the spot): 
> 
> print FORM1 <<EndOfForm; 
> Content-type: text/html 
> 
> <HTML><BODY> 
> Your name: $client_name <BR> 
> Your address: $client_address <P> 
> 
> Your hobbies: $client_hobbies <P> 
> </BODY></HTML> 
> EndOfForm 
> 
> Just take the HTML form and paste it into your Perl script, putting 
> the 
> variables where they need to be (for checkboxes, pull-down menus, 
> radio 
> buttons, you would put the values into the "Default = " part of the 
> HTML 
> code). Now, my HTML syntax might be a little off, but I hope the idea 
> comes across. If you want just a plain text file with the user input 
> in 
> it, then just leave out all the HTML stuff and format it as you want 
> to. 
> 
> If this is not what you want to do, please explain more. 


-- 
Cameron Dorey 
Associate Professor of Chemistry 
University of Central Arkansas 
Phone: 501-450-5938 
[EMAIL PROTECTED] 
_______________________________________________ 
Perl-Win32-Web mailing list 
[EMAIL PROTECTED] 
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
<http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web>  


------_=_NextPart_001_01C049D9.C8FB09C0
Content-Type: text/html;
        charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: Emailing forms w/data intact</TITLE>

<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=906592316-08112000>That's 
it exactly, Jonathan (the former, that is).&nbsp; I want to create a script that 
I can pass an HTML file to (which contains a form), have the user fill it out, 
then process it enough to create a new HTML file with the form data that the 
user entered.&nbsp; Some forms will be&nbsp;filled out by salespeople for 
customers.&nbsp; Some forms will be&nbsp;emailed&nbsp;around to several people 
for, say, approving purchase orders.&nbsp; To put it another way,&nbsp;here is 
my goal: if you looked at the resulting HTML file with a browser, the form data 
would already be there.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=906592316-08112000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=906592316-08112000>I've 
been looking at HTML::TokeParser, HTML::Parser, and 
HTML::FillInForm.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=906592316-08112000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=906592316-08112000>I&nbsp;despise asking other people to do my work for 
me.&nbsp; But code suggestions, or a book recommendation, would be 
appreciated.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=906592316-08112000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=906592316-08112000>TIA!</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=906592316-08112000>-WM&nbsp; &lt;&gt;&lt;</SPAN></FONT></DIV>
<DIV><SPAN class=906592316-08112000></SPAN><FONT face=Tahoma><FONT size=2><SPAN 
class=906592316-08112000><FONT color=#0000ff 
face=Arial>&nbsp;</FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Tahoma><FONT size=2><SPAN 
class=906592316-08112000>&nbsp;</SPAN>-----Original Message-----<BR><B>From:</B> 
Jonathan Crowther [mailto:[EMAIL PROTECTED]]<BR><B>Sent:</B> 
Wednesday, November 08, 2000 10:04 AM<BR><B>To:</B> 'Thomas_M'<BR><B>Cc:</B> 
[EMAIL PROTECTED]; 
'[EMAIL PROTECTED]'<BR><B>Subject:</B> RE: Emailing forms w/data 
intact<BR><BR></DIV></FONT>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px"></FONT>
  <P><FONT size=2>He said :</FONT> <BR><FONT size=2>&nbsp;&nbsp;&nbsp; About 100 
  forms (in HTML files) were created by a couple of </FONT><BR><FONT 
  size=2>&nbsp;&nbsp;&nbsp; interns last summer, and I'd prefer to pass the form 
  name as part</FONT> <BR><FONT size=2>&nbsp;&nbsp;&nbsp; of the query string 
  </FONT></P>
  <P><FONT size=2>He doesn't want to re-write all 100 forms into Perl, which is 
  what you are telling him to do.</FONT> </P>
  <P><FONT size=2>Personally, in such a situation, I would write a Perl script 
  that I run once that would convert all the HTML to pure Perl, and then do what 
  you suggest, but if he really doesn't want to use Perl natively (i.e. keep the 
  pure HTML files), he needs to do on-line parsing of each HTML to extract the 
  form elements and replace them with the submitted values.</FONT></P>
  <P><FONT size=2>Of course, if he doesn't care about the format of the 
  resulting pages (i.e. if they don't have to follow any logical visual 
  ordering), he could just dump the "param()" keys and values to the file, and 
  not bother parsing the HTML, but I don't think that's what he was 
  asking.</FONT></P>
  <P><FONT size=2>William?</FONT> </P>
  <P><FONT size=2>Cheers,</FONT> <BR><FONT size=2>Jonathan</FONT> </P><BR>
  <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
  Thomas_M [<A 
  href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]</FONT> <BR><FONT 
  size=2>Sent: Wednesday, November 08, 2000 5:19 AM</FONT> <BR><FONT size=2>To: 
  Crowther, Jonathan [ORCH:9T03-M:EXCH];</FONT> <BR><FONT 
  size=2>[EMAIL PROTECTED]; 
  '[EMAIL PROTECTED]'</FONT> <BR><FONT size=2>Subject: RE: Emailing 
  forms w/data intact</FONT> </P><BR>
  <P><FONT size=2>Why would he need to do all that? Assuming he uses CGI.pm to 
  generate the</FONT> <BR><FONT size=2>form, he can simply print out the form 
  fields or the result if it exists.</FONT> </P>
  <P><FONT size=2>Something along the lines of:</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>if (param()) 
  {</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>print 
  
param('name');&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
  # print response</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  size=2>} else {</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>print 
  textfield(-name=&gt;'name' ...); # print form field</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>}</FONT> </P>
  <P><FONT size=2>or, more simply,</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>print param()? 
  param('name') : textfield(-name=&gt;'name');</FONT> </P>
  <P><FONT size=2>and if you wanted to only print the non-blank 
  responses:</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  size=2>print param('name') || textfield(-name=&gt;'name');</FONT> </P>
  <P><FONT size=2>--</FONT> <BR><FONT size=2>Mark 
  
Thomas&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
  [EMAIL PROTECTED]</FONT> <BR><FONT size=2>Sr. Internet 
  Architect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; User Technology 
  Associates, Inc.</FONT> </P>
  <P><FONT size=2>$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; 
  ;;print;;</FONT> </P>
  <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
  Jonathan Crowther [<A 
  
href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]</FONT>
 
  <BR><FONT size=2>Sent: Tuesday, November 07, 2000 7:14 PM</FONT> <BR><FONT 
  size=2>To: [EMAIL PROTECTED]; 
  '[EMAIL PROTECTED]'</FONT> <BR><FONT size=2>Subject: RE: Emailing 
  forms w/data intact</FONT> </P><BR>
  <P><FONT size=2>Given that you already have the HTML files, and you need to 
  scan them for</FONT> <BR><FONT size=2>the form tags that you want to replace 
  with the values submitted, you could</FONT> <BR><FONT size=2>also look at 
  using the HTML parser to scan the HTML tags, such as the</FONT> <BR><FONT 
  size=2>following:</FONT> <BR><FONT size=2>HTML::TreeBuilder </FONT><BR><FONT 
  size=2>HTML::Parser </FONT><BR><FONT size=2>HTML::TokeParser </FONT><BR><FONT 
  size=2>HTML::Form </FONT><BR><FONT size=2>HTML::Element </FONT><BR><FONT 
  size=2>I have never used these myself, but they look useful in your case. 
  </FONT><BR><FONT size=2>The methodology would be: </FONT><BR><FONT size=2>1. 
  Use CGI.pm to read the query (including for form name and key/value</FONT> 
  <BR><FONT size=2>pairs) </FONT><BR><FONT size=2>2. Use HTML::TreeBuilder to 
  scan the HTML page </FONT><BR><FONT size=2>3. Replace Form elements with 
  values entered (in 1.) using </FONT><BR><FONT size=2>4. Use CGI.pm and also 
  "print $h-&gt;as_HTML" to print the HTML elements out </FONT><BR><FONT 
  size=2>5. Use Net::SMTP to send the e-mail </FONT><BR><FONT size=2>Looking at 
  this again, you may want to go with HTML::TokeParser instead of</FONT> 
  <BR><FONT size=2>HTML::TreeBuilder.... any way, you can continue 
  looking...</FONT> <BR><FONT size=2>Cheers, </FONT><BR><FONT size=2>Jonathan 
  </FONT><BR><FONT size=2>"Joust Not with Dragons, for Thou art Crunchy, and 
  Goode with Ketchup..." </FONT></P><BR>
  <P><FONT size=2>-----Original Message----- </FONT><BR><FONT size=2>From: 
  Cameron Dorey [<A 
  href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>] 
  </FONT><BR><FONT size=2>Sent: Tuesday, November 07, 2000 3:34 PM 
  </FONT><BR><FONT size=2>To: [EMAIL PROTECTED] 
  </FONT><BR><FONT size=2>Subject: Re: Emailing forms w/data intact 
  </FONT></P><BR>
  <P><FONT size=2>&gt; [EMAIL PROTECTED] wrote: </FONT><BR><FONT 
  size=2>&gt; </FONT><BR><FONT size=2>&gt; I want to let a user click a link 
  which runs a Perl program, passing a </FONT><BR><FONT size=2>&gt; filename on 
  the query string (like </FONT><BR><FONT size=2>&gt; <A 
  href="http://www.domain.com/cgi-bin/process_form.pl?form=testform.html" 
  target=_blank>http://www.domain.com/cgi-bin/process_form.pl?form=testform.html</A>). 

  </FONT><BR><FONT size=2>&gt; Easy. </FONT><BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; Then, after the user fills out and submits the 
  form, I want to combine </FONT><BR><FONT size=2>&gt; the user's responses and 
  the form, and save it in a separate HTML </FONT><BR><FONT size=2>&gt; file. In 
  other words, I want a file that looks just like what the user </FONT><BR><FONT 
  size=2>&gt; filled out, with the data. Tough (?). </FONT><BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; Finally, I want to email that document to another 
  party. Easy. </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; I 
  created a fairly nice script which you can place an HTML form into. 
  </FONT><BR><FONT size=2>&gt; (You only need to insert perl variables 
  strategically.) I'd rather not </FONT><BR><FONT size=2>&gt; create 100 similar 
  Perl applications if I can help it. :) </FONT><BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; Can this be done? I think it can be using CGI.pm. 
  </FONT><BR><FONT size=2>See below, that's how I would do it. Just read your 
  HTML file into a </FONT><BR><FONT size=2>filehandle and stick the user inputs 
  into it, then print back out. I was </FONT><BR><FONT size=2>just suggesting 
  (strongly) that as long as you are using CGI.pm (and I </FONT><BR><FONT 
  size=2>would always use CGI.pm), use it effectively, let it do the 
  </FONT><BR><FONT size=2>packing/unpacking/splitting/tr'ing, don't reinvent the 
  wheel. </FONT><BR><FONT size=2>Cameron </FONT><BR><FONT size=2>&gt; 
  -----Original Message----- </FONT><BR><FONT size=2>&gt; From: Cameron Dorey 
  [<A href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>] 
  </FONT><BR><FONT size=2>&gt; Sent: Tuesday, November 07, 2000 4:26 PM 
  </FONT><BR><FONT size=2>&gt; To: [EMAIL PROTECTED] 
  </FONT><BR><FONT size=2>&gt; Subject: Re: Emailing forms w/data intact 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; &gt; 
  [EMAIL PROTECTED] wrote: </FONT><BR><FONT size=2>&gt; &gt; 
  </FONT><BR><FONT size=2>&gt; &gt; Can someone wind me up and point me in the 
  right direction? </FONT><BR><FONT size=2>&gt; &gt; </FONT><BR><FONT 
  size=2>&gt; &gt; I'm trying to let users submit an HTML form into a file, with 
  data </FONT><BR><FONT size=2>&gt; &gt; intact.&nbsp; About 100 forms (in HTML 
  files) were created by a couple of </FONT><BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; &gt; interns last summer, and I'd prefer to pass 
  the form name as part of </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; &gt; the query string (like process_form.pl?form=testform.html). 
  </FONT><BR><FONT size=2>&gt; &gt; </FONT><BR><FONT size=2>&gt; &gt; I've 
  looked at CGI.pm </FONT><BR><FONT size=2>&gt; &gt; (<A 
  href="http://www.perl.com/pub/doc/manual/html/lib/CGI.html" 
  target=_blank>http://www.perl.com/pub/doc/manual/html/lib/CGI.html</A>), and 
  the </FONT><BR><FONT size=2>&gt; tools </FONT><BR><FONT size=2>&gt; &gt; are 
  right there, but I can't seem to piece them together. </FONT><BR><FONT 
  size=2>&gt; &gt; </FONT><BR><FONT size=2>&gt; &gt; I know well how to fetch 
  data from a submit, how to process it, how </FONT><BR><FONT size=2>&gt; to 
  </FONT><BR><FONT size=2>&gt; &gt; email a file, etc., and I've used Perl for 
  about two years. It's </FONT><BR><FONT size=2>&gt; &gt; re-inserting the data 
  back into a form that I'm stumbling over. </FONT><BR><FONT size=2>&gt; &gt; 
  </FONT><BR><FONT size=2>&gt; &gt; Here's where I'm at now, for starters. 
  </FONT><BR><FONT size=2>&gt; &gt; </FONT><BR><FONT size=2>&gt; &gt; [code 
  snipped] </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; Good golly, 
  Miss Molly, pardon me, but what are you trying to do here </FONT><BR><FONT 
  size=2>&gt; with all those split/tr/packs? CGI.pm lets you work with forms 
  without </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; having to do 
  all the splitting yourself, it's all in the docs. </FONT><BR><FONT size=2>&gt; 
  Basically, your parameters are from the form itself and you just pull 
  </FONT><BR><FONT size=2>&gt; them out by a statement like: </FONT><BR><FONT 
  size=2>&gt; </FONT><BR><FONT size=2>&gt; $client_name = $cgi-&gt;param(name); 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; for all your fields. 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; Now, I'm not exactly 
  sure what you want to save, is it the filled-out </FONT><BR><FONT size=2>&gt; 
  form with the user inputs in boxes exactly like the user would see 
  </FONT><BR><FONT size=2>&gt; them? </FONT><BR><FONT size=2>&gt; the filled-out 
  form with the user inputs looking like they were part </FONT><BR><FONT 
  size=2>&gt; of </FONT><BR><FONT size=2>&gt; the form text? Whichever way, 
  probably the easiest way I can think of </FONT><BR><FONT size=2>&gt; to 
  </FONT><BR><FONT size=2>&gt; save them is to print your form to a file as a 
  "here document" putting </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; the variables in at the appropriate places, such as (just cobbled 
  up </FONT><BR><FONT size=2>&gt; on </FONT><BR><FONT size=2>&gt; the spot): 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; print FORM1 
  &lt;&lt;EndOfForm; </FONT><BR><FONT size=2>&gt; Content-type: text/html 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; 
  &lt;HTML&gt;&lt;BODY&gt; </FONT><BR><FONT size=2>&gt; Your name: $client_name 
  &lt;BR&gt; </FONT><BR><FONT size=2>&gt; Your address: $client_address 
  &lt;P&gt; </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; Your 
  hobbies: $client_hobbies &lt;P&gt; </FONT><BR><FONT size=2>&gt; 
  &lt;/BODY&gt;&lt;/HTML&gt; </FONT><BR><FONT size=2>&gt; EndOfForm 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; Just take the HTML 
  form and paste it into your Perl script, putting </FONT><BR><FONT size=2>&gt; 
  the </FONT><BR><FONT size=2>&gt; variables where they need to be (for 
  checkboxes, pull-down menus, </FONT><BR><FONT size=2>&gt; radio 
  </FONT><BR><FONT size=2>&gt; buttons, you would put the values into the 
  "Default = " part of the </FONT><BR><FONT size=2>&gt; HTML </FONT><BR><FONT 
  size=2>&gt; code). Now, my HTML syntax might be a little off, but I hope the 
  idea </FONT><BR><FONT size=2>&gt; comes across. If you want just a plain text 
  file with the user input </FONT><BR><FONT size=2>&gt; in </FONT><BR><FONT 
  size=2>&gt; it, then just leave out all the HTML stuff and format it as you 
  want </FONT><BR><FONT size=2>&gt; to. </FONT><BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; If this is not what you want to do, please 
  explain more. </FONT></P><BR>
  <P><FONT size=2>-- </FONT><BR><FONT size=2>Cameron Dorey </FONT><BR><FONT 
  size=2>Associate Professor of Chemistry </FONT><BR><FONT size=2>University of 
  Central Arkansas </FONT><BR><FONT size=2>Phone: 501-450-5938 </FONT><BR><FONT 
  size=2>[EMAIL PROTECTED] </FONT><BR><FONT 
  size=2>_______________________________________________ </FONT><BR><FONT 
  size=2>Perl-Win32-Web mailing list </FONT><BR><FONT 
  size=2>[EMAIL PROTECTED] </FONT><BR><FONT size=2><A 
  href="http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web" 
  target=_blank>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web</A> 
  </FONT></P></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C049D9.C8FB09C0--

--__--__--

Message: 2
From: "Purcell, Scott" <[EMAIL PROTECTED]>
To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
Subject: Cookie vs Text File For State
Date: Thu, 9 Nov 2000 08:41:49 -0600
charset="iso-8859-1"

Hello and Good Day,

I have a question about holding state. I have a large-scale application (web
based), and I use a uniquely identified text file to keep track of the user
as he surfs my site. As the product gets larger, so does this state text
file: (below is an actual text file). So what occurs here is that I put in a
hidden number that correlates with the below text file. And each time the
user does a submit and begins a session, I read the below file, put it into
a hash and off we go again.

My problem is that I am starting to have some speed issues. I am wondering
if a "Cookie" would be faster, and if it is, is the below data too much data
for a cookie.?

I understand what a cookie does, but I have never created one. So if a
cookie may be the best way to go, with this large amount of information,
would you tell me if the cgi.pm module is best for this, or how I should
possibly approach this challenge, or just stay my course with the text file.


Thanks a lot, I appreciate any input.
Scott Purcell

########## STATE FILE BELOW #########

text file:
OT_ART208_HolidayApprov: N
OT_Art209a_Valentines: N
OT_Spring009: N
OT_TV006J: N
OT_TV008_AllSeas: N
OT_TV010_Easter: N
access: 3
annotate: N
approval: Y
autoapprove: N
canupld: F 
clipboard:      13438 
crop: Y
csremail:  
customer: otc
dimunits: in       
dropndrag: N
eforms: Y
encpasswd:
d02f42d0510359476256e377d9925b7def78fd4aa52de999d724d646e11fbeba58
group: OTC_Studio_Admin_Apv
login time: Nov 8 15:34:37
mconverter: N
mode: icon
no_cols:   
no_rows:   
pmanager: N
portfolio: N
profile: OTC
report_count: 1
report_dblist: /DISK2/VBank/DataBases/STUDIO/ot_art209a_valentines.dbf
report_qstr: ('45_1730'$UPPER(FILENAME))
selects: N
serversid: aslechta_3008643_0
superlb: N
thumbqual: faster
thumbsize: medium
user: aslechta
userrecordno: 337 
xport: N
zoom: Y


--__--__--

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web


End of Perl-Win32-Web Digest_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web


_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to