$Querryname=$Formdata[0]; $Searchstring=$Formdata[1]; $libstitle=$Formdata[2]; $type=$Formdata[4]; $searchtype=$Formdata[5]; # Begin Test code for that freaky check box problem $loopcounter = 0; while ( $loopcounter <= 5 ) { @libstosearch[$loopcounter] = $Formdata[3][$loopcounter]; $loopcounter++; } # We really should have + signs between everything that we pass to the library CGI $Searchstring=~/\Q$Searchstring\E/; $Searchstring =~ s/ /\+/g; # Here's where I'll get the flag variables ready. If a flag is true, then that library # is searched. If false, then the user gets the "Didn't search" page. $libone = 0; $libtwo = 0; $libthree = 0; $libfour = 0; $libfive = 0; $libsix = 0; # Ok. Now we can get on with the business of throwing the right flags. foreach $i (@libstosearch) { if ($i eq 'first') { $libone = 1; } elsif ($i eq 'second') { $libtwo = 1; } elsif ($i eq 'third') { $libthree = 1; } elsif ($i eq 'fourth') { $libfour = 1; } elsif ($i eq 'fifth') { $libfive = 1; } elsif ($i eq 'sixth') { $libsix = 1; } } #Below is the old code # That was painful, wasn't it? # Now I'll set the false libraries to the "Didn't Search" page #if ($libone < 1) { $one = "\n"; } #if ($libtwo < 1 ) { $two = "\n";} #if ($libthree < 1 ) { $three = "\n";} #if ($libfour < 1 ) { $four = "\n";} #if ($libfive < 1 ) { $five = "\n";} #if ($libsix < 1 ) { $six = "\n";} # Let's fire up those space variables @space = (); $one = ("\n"); $two = ("\n"); $three = ("\n"); $four = ("\n"); $five = ("\n"); $six = ("\n"); # Here's the new code. If the search for a particular library is false, we print a carriage return, # and set the space variable to null if ($libone <= 1) { $one = "\n\n"; shift("\*", @space); } if ($libtwo <= 1 ) { $two = "\n\n"; $space2 = (); } if ($libthree <= 1 ) { $three = "\n\n"; $space3 = (); } if ($libfour <= 1 ) { $four = "\n\n"; $space4 = (); } if ($libfive <= 1 ) { $five = "\n\n"; $space5 = (); } if ($libsix <= 1 ) { $six = "\n\n"; $space6 = (); } print "Content-type: text/html\n\n"; print <<'HEADER';