Hello all,
This is my first post, so bear with me.
I have a form that activates a cgi script that scans a flat-file *.csv
file, matches on a unique identifier, identifies the line that contains the
identifier, and pushes the separated values of that line into an array.
I want to pass those values into another (second) cgi script, but I don't
know how.
I made the original script display the values of the line in "text" input
boxes in a web page the original cgi script created after finding the
correct line. This essentially creates a new form that *theoretically* you
should be able to parse with a new script. However, when I push submit,
the form runs the ORIGINAL script and passes all the data from the new form
into the URL (i.e. "ref.cgi?n0=052802151217&n1=2...").
Who do I fix this.
Below is the original perl cgi script (I numbered the lines for this
email). You can see that on line 56 I want to pass the values to the new
reprint.cgi. That is where I'm having problems. They won't pass.
I would appreciate any help anyone can give.
Richard J. Moyer III
[EMAIL PROTECTED]
01 #!/usr/bin/perl
02
03 print "Content-type:text/html\n\n";
04
05 read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
06 @pairs = split(/&/, $buffer);
07 foreach $pair (@pairs) {
08 ($name, $value) = split(/=/, $pair);
09 $value =~ tr/+/ /;
10 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
11 $FORM{$name} = $value;
12 }
13
14 $reference = $FORM{'ref'};
15
16 #-----------------------------------------------------------
17 #---- COMPARE REFERENCE NUMBER TO DATA
18#-----------------------------------------------------------
19 open (DATA, "<../data/data.csv") or die &error;
20 while ($line = <DATA>) {
21 if ($line =~ /($reference)/){
22 push @newdata, $line;
23 }
24 }
25 close (numbers);
26
27 #-----------------------------------------------------------
18 #--- OK -- OK -- OK -- OK -- OK -- OK --
29 #-----------------------------------------------------------
30$begin=0;
31 for($i=0; $i < length $newdata[$#newdata]; $i++) {
32 if ((substr $newdata[$#newdata], $i, 1) eq "," or (substr
$newdata[$#newdata], $i, 1) eq "\n") {
33 push @tokens, (substr $newdata[$#newdata], $begin, $i-$begin);
34 $begin = $i+1;
35 }
36 }
37 if ($tokens[1] >= "1"){
38 $episode = $tokens[1];
39 $nextepisode = $episode + 1;
40
41 print <<EndOfHTML;
42 <html>
43 <head>
44 <title>CHUG Output</title>
45 </head>
46 <body bgcolor=#cc6600>
47 <table width="100%" cellspacing=7 cellpadding=0 border=1 bgcolor=#ffffff>
48 <tr>
49 <td align="left" valign="top" colspan="2"><p class="text">What would
you like to do now?</td>
50 </tr>
51 <tr>
52 <td align="left" valign="top" width="50%">
53 <table width="100%" cellspacing=7 cellpadding=0 border=1
bgcolor=#ffdddd>
54 <tr>
55 <td>
56 <form name="reprint" action="reprint.cgi" method="post">
57 <input type="text" name="n0" value="$tokens[0]"> REFERENCE
NUMBER<br>
58 <input type="text" name="n5" value="$tokens[3]"> Sex</br>
59 <input type="text" name="n6" value="$tokens[5]"> Weight</br>
60 <input type="text" name="n7" value="$tokens[58]"> percent less</br>
61 <input type="text" name="n11" value="$tokens[70]"> Negcon</br>
62 <input type="submit" name="submit">
63 </form>
64 </td>
65 </td>
66 </tr>
67 </table>
68 </form>
69 </td>
70 </tr>
71</table>
72 </body>
73 </html>
74 EndOfHTML
75 exit;
76 }