#!/usr/bin/perl -w use strict; use CGI qw(:standard); ## start file print header(), start_html(-title=>"Street Print CD Catalog", -background=>'/images/catalogbackground.jpg'); print "

"; ##collect the data from my forms page my $filename = param('filename'); ## a text box to enter in a ## whole or part file name my $color = param('color');## pull down menu ## searches color types. default Any my $pattern = param('pattern'); ## pull down menu ## searches pattern types. default Any my $Typeofprint = param('Typeofprint'); ## A dialog of radio ## buttons. Submitted data looks like either a single number, ## or a list of numbers ex) "1" or "1 2 3 15 22" my $highres = param('highres'); ## yes or no high res chomp ($filename, $color, $pattern, $Typeofprint, $highres); ## make sure no \n stuff follows it ## the beginning of the table print ""; ## open the DBFILE, located in the same directory open (DBFILE, 'scfrom.db') or die "$!"; ## for each line of the DBFILE while (my $line = ) { chomp $line; $line =~ tr/\r\n//d;## get rid of white space my @record = split /\|/, $line, 7; ## split it up into.... ## $record[0] is name, 1 => color, 2 => pattern, 3 => cd, ## 4 => thumbnail picture, 5=> screen res picture, 6=> yes or no high res. my @cdnumbers = split / /, $Typeofprint; ## split by whitespace, ## so cd numbers don't run into eachother ## ex 1 isn't in 12 :P if ($color eq "Any" || $record[1] =~ /^$color$/i ## if color is Any or matches the DBFILE and $pattern eq "Any" || $record[2] =~ /^$pattern$/i ## if pattern is Any or matches DBFILE and $highres eq "Any" || $record[6] eq 'Yes' ## if highres is Any or if the record says Yes or $filename =~ /^$record[0]$/igc ## if file name is located in $record[0]) { my $i; ## while the $cdnumbers for that selection are checked by the DBFILE while ($cdnumbers[$i]) { if ($Typeofprint eq "Any" or $cdnumbers[$i] =~ /^$record[3]$/i) ## if it's any or it matches { print "\n"; ## the actual code :) next; } } } } print '

Name

Picture number
followed by name

Color

Pattern

CD Number

High res, 300 dpi image available on CD?

Thumbnail Image

**Click to enlarge**
$record[0]$record[1]$record[2]$record[3]$record[6]
'; print end_html;