> I have this CGI set up on my server (W* 2.0): > #!perl > > $| = 1; > if ($ENV'REQUEST_METHOD' eq 'POST') > > read(STDIN, $buffer, $ENV'CONTENT_LENGTH'); > @pairs = split(/&/, $buffer); > foreach $pair (@pairs) > > ($name, $value) = split(/=/, $pair); > $value =~ tr/+/ /; > $value =~ s/%([a-fA-f0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $contents$name = $value; > > > > $category = $contents'category'; > $catetext = $contents'catetext'; > $category =~ tr// /; > $catetext =~ tr// /; > > open( IN , "<<classifieds.data"); > read FILE,$text,1000000000; > close (IN); > > @records = split(//,$text); > > if ($category == "None" && $catetext == "") there is an error here : this is not '==' but 'eq' if ($category <bold>eq </bold> "None" && $catetext <bold>eq </bold> "") > $theReply = <<<<HT_ML; > Content-type: text/html > > <<html><<head><<title>Clarity Connect Classifieds<</title><</head><<body> > You need to enter information to search for, first.<<br>category: > $category<<br>text: $catetext<</body><</html> > HT_ML > > print $theReply; > print ""; > exit; > > > $i = 0; > $results = ""; > if ($category != "none" && $catetext != "") same mistake : if ($category <bold>ne </bold> "none" && $catetext <bold>ne </bold> "") > until ($i++ == $#records) > if (($records[$i] =~ /$category/gi) && ($records[$i] =~ /$catetext/gi)) $results .= "$records[$i]"; > > > > if ($category != "none" && $catetext == "") if ($category <bold>ne </bold> "none" && $catetext <bold>eq </bold> "") > until ($i++ == $#records) > if ($records[$i] =~ /$category/gi) $results .= "$records[$i]"; > > > > if ($category == "none") if ($category <bold>eq </bold> "none") > until ($i++ == $#records) > if ($records[$i] =~ /$catetext/gi) $results .= "$records[$i]"; > > > > $theReply = <<<<HT_ML; > Content-type: text/html > > <<html><<head><<title>Clarity Connect Online Classifieds<</title><</head><<body> > Your search results:<<br><<br> > $records<</body><</html> > HT_ML > > print $theReply; > print ""; > > and I'm getting this response: > > You need to enter information to search for, first. > category: Other > text: stuff > > Which is impossible, to my mind, because in order to get that message, > category and text BOTH have to be different than what they are. > > Any ideas? > > -Seraph > > This is a very classic error.. :-) If suggest that in many cases, a case insensitive match is better than a comparison : if ($category =~ /none/i) ... This has the advantage that you don't have to know if it is needed to send a "None" or a "none" or a "NONE" to your CGI. ------------------------- APERGHIS-TRAMONI Sebastien Word Wide Web : http://www.resus.org/~madingue E-Mail : madingue@cis.uni-muenchen.de (madingue@tango.resus.univ-mrs.fr) </x-rich>