Re: passing variables from one form to another using Perl

by "Jan Morell" <jan_man(at)bellsouth.net>

 Date:  Wed, 27 Dec 2000 18:29:10 -0500
 To:  "Cyanide _7" <leo7278(at)hotmail.com>
 Cc:  <hwg-languages(at)hwg.org>
 References:  hotmail
  todo: View Thread, Original
I finally got it.  I isolated the content of the value statement on a line
by itself so I could debug it easier.  The final code that works is:

print "".$ON."\n" ; where $ON is the variable.

Thanks to you and Doug Franklin for your help.

----- Original Message -----
From: "Cyanide _7" <leo7278(at)hotmail.com>
To: <jan_man(at)bellsouth.net>
Cc: <hwg-languages(at)hwg.org>
Sent: Wednesday, December 27, 2000 5:10 PM
Subject: Re: passing variables from one form to another using Perl


disclaimer: i dont know perl
assumption: the code:
  $ON = $field{'ON'} ; #Category
is correct in obtaining the value of the named field.

with that said, your code should work. i recommend encompassing your VALUE
attribute with double quotes. also, make sure (via the source) that whats
being written from $ON does not contain any quotes itself. if so, i
recommend replacing them with HTML equivalents or just HTML encoding the
entire line (i'm not even sure if perl has such a thing, but im sure you
could write one). for example, if $ON contained the string foo"bar" and you
wanted that to appear in the next form, the HTML should read <INPUT
NAME="data1" VALUE="foo&quot;bar&quot;">. is this your problem? also, i try
to always use double quotes in HTML as well as scripting for strings of any
kind, and i escape any quote contained by the string. i guess its just habit
from Java, but its safer than trying to put doublequotes into single quotes.
- Cyanide_7

>Sure Doug,
>
>The second page is being generated by a CGI. The section in question is
>below:
>
>Here are the variables:
>
>$ON = $field{'ON'} ; #Category
>$Sub = $field{'Sub'} ; #Sub-Category
>$S1 = $field{'S1'} ; #Question
>
>Here is the section where I am trying to insert them:  ( into data0, data1,
>and data2) *note:  There might be some word wrapping here. (In this example
>I had tried single quotes.)
>
>print '                                      <input type="text"
>name="data0"
>value=\'$ON\'>'."\n" ;
>print "                                    </p>\n" ;
>print "                            </td>\n" ;
>print '                                  <td width="334"> <font
>face="verdana, arial, helvetica" size="2" color="#000080"><b>Subcategory
>'."\n" ;
>print "                                    </b></font> \n" ;
>print '                                    <input type="text" name="data1"
>value=\'$Sub\'>'."\n" ;
>print "                                  </td>\n" ;
>
>------------SNIP-------------------------
>
>print "                                      The more information you give
>us,&nbsp;<br>\n" ;
>print "                                      the faster and more accurate
>our response \n" ;
>print "                                      will be.<br>\n" ;
>print '                                      <textarea rows="2"
>name="data2"
>cols="54">\'$S1\'</textarea>'."\n" ;
>
>
>If you need any other information, let me know.
>
>Jan
>
>
>----- Original Message -----
>From: "Franklin, Douglass" <Douglass.Franklin(at)ssa.gov>
>To: "'Jan Morell'" <jan_man(at)bellsouth.net>; <hwg-languages(at)hwg.org>
>Sent: Wednesday, December 27, 2000 2:04 PM
>Subject: RE: passing variables from one form to another using Perl
>
>
>Jan -
>
>Would you send a snippet of page #2?  I believe I can help.
>
>- Doug
>
>-----Original Message-----
>From: Jan Morell [mailto:jan_man(at)bellsouth.net]
>Sent: Wednesday, December 27, 2000 11:59 AM
>To: hwg-languages(at)hwg.org
>Subject: passing variables from one form to another using Perl
>
>
>I have seen something like this before, but the HWG search seems to be out
>so I was not able to check the archives.
>
>I have a two part form where the visitor fills in some information and then
>that information should be passed to another form filling in the fields
>with
>the information that the visitor has supplied using Perl
>
>I have no trouble passing the contents of the form variables to the body of
>the page, but when I try to put them into the 'value' of the form element,
>it only shows the variable name and not the value.
>
>I have tried to enclose the variable name in single, and double quotes, and
>no quotes.  What is the format that a variable going into another form
>element should follow?
>
>Thanks in advance.  If you need any snippets, I would be happy to include
>them.
>
>Jan
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA