I am trying to modify a job posting perl-cgi script so that a person can select more than one job to apply for. After they have selected the jobs that they want, I want this information to be placed into $ENV{'QUERY_STRING'} in this format: STXXXX+STCCC+STDDD, so that the next url looks like this: foo.com/cgi-bin/test.pl?STCCC+STXXX+STDDD+..I want these numbers to be able to be passed on as they go through the application process.. Here is an example of the first script - the form where they select the jobs:
#!/usr/local/bin/perl push (@INC, "\\foo\\cgi-bin\\hotjobs\\"); require "jobs_prefs.pl"; $jobdata="\\foo\\hotjobs\\data\\jobs.txt"; $sortfunction = sort_func; print "Content-type:text/html\n\n"; print "<html><head><title>TEST</title></head><body>"; print "<FORM ACTION=/cgi-bin/pmquestion2.pl method=post>"; open(DB2,,$jobdata); @indata = <DB2>; close(DB2); print "<P ALIGN=CENTER><IMG SRC=http://www.foo.com/images/stlogo.gif W +IDTH=220 HEIGHT=73><BR>"; print "<IMG SRC=http://www.foo.com/images/stdesign.gif WIDTH=220 HEIGH +T=47 ALT=artwork></P>"; print "<FONT FACE=Arial SIZE=2><P ALIGN=CENTER>Please click <a href=ht +tp://www.foo.com/hotjobs.html>here</a>". " to search our database of available jobs.</center><FONT FACE=Arial S +IZE=2> </P>"; print "<P ALIGN=CENTER><CENTER><TABLE BORDER CELLSPACING=1 BORDERCOLOR +=#000000 CELLPADDING=7 WIDTH=597>"; print "<TR><TD WIDTH=8% VALIGN=TOP BGCOLOR=#0000CD HEIGHT=17>"; print "<P><B><FONT FACE=Arial SIZE=2 COLOR=#ffffff>APPLY?</B></FONT></ +TD>"; print "<TD WIDTH=11% VALIGN=TOP BGCOLOR=#0000CD HEIGHT=17>"; print "<B><FONT FACE=Arial SIZE=2 COLOR=#ffffff><P>JOB #</B></FONT></T +D>"; print "<TD WIDTH=55% VALIGN=TOP BGCOLOR=#0000CD HEIGHT=17>"; print "<B><FONT FACE=Arial SIZE=2 COLOR=#ffffff><P>TITLE (Click to rea +d the description)</B></FONT></TD>"; print "<TD WIDTH=26% VALIGN=TOP BGCOLOR=#0000CD HEIGHT=17>"; print "<B><FONT FACE=Arial SIZE=2 COLOR=#ffffff><P>LOCATION</B></FONT> +<FONT FACE=Arial SIZE=2></TD></TR>\n"; @reverse = reverse(@indata); foreach $i (sort $sortfunction @reverse) { chop($i); ($Index,$Date,$Title,$Category,$JobCode,$Description,$Requirements,$Co +ntract,$field9,$field10,$field11,$field12,$City,$State,$field15) = sp +lit("\t",$i,15); print "<FONT FACE=Arial SIZE=2><tr>"; print "<FONT FACE=Arial SIZE=2><td><input type=checkbox name=JobID val +ue=$JobCode></td>"; print "<FONT FACE=Arial SIZE=2><td>$JobCode</td>"; print "<FONT FACE=Arial SIZE=2><td><a href=http://www.foo.com/cgi-bin/ +hotjobs/jobs_view.pl?index=$Index>$Title</a></td>"; print "<FONT FACE=Arial SIZE=2><td>$City, $State</td>"; print "</tr>\n"; } #print "($reverse[0]('Date'))"; #$record1 = ($Date($reverse[0])); #print "$record1 "; print "</table><p><center><input type=submit name=submit value=Apply F +or Jobs></form></center></font>"; print "</body></html>";
Here is an example of the 2nd script - where the first script is posting to:
#!/usr/local/bin/perl use CGI qw(:standard); @jid = param('JobID'); print "Content-type: text/html\n\n"; print "<head><title>TEST SCRIPT</title>"; print "</head><font size=2 face=arial><p>"; foreach $jid (@jid) { print "+$jid"; } $ENV{'QUERY_STRING'} eq (print "+$jid"); #$ENV{'QUERY_STRING'} = print "+$jid"; } print "<p><a href=http://www.foo.com/cgi-bin/test2.pl?$ENV{'QUERY_STRI +NG'}>http://www.foo.com/cgi-bin/test2.pl?$ENV{'QUERY_STRING'}</a><p>" +; print "<p><a href=http://www.foo.com/cgi-bin/test2.pl?$ENV{'QUERY_STRI +NG'}>http://www.foo.com/cgi-bin/test2.pl?$ENV{'QUERY_STRING'}</a>"; print "</FORM><p></center></center></td></tr></table></BODY>";
This isn't working! What am I doing wrong? Is there another way to do this besides what I am trying to do? Any help would be greatly appreciated.

In reply to How to get into $ENV{'QUERY_STRING'}? by dominica1000

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.