form input changed from Select to hidden, no errors and no search results 
Author Message
 form input changed from Select to hidden, no errors and no search results

Hi,
I'm working on modifying a the MSA Simple Search script for my site.  It's
written in perl.  The bug I have encountered is that when I changed the
boolean and case Select fields into hidden fields the script still runs
without error but returns no results even though the results display the
vars and they are the same whichever way I do it.  So the script is
receiving the vars, putting them in into the mix but somehow then
eliminating all the results.  I triple checked spelling and case between the
2 setups and they match.
Any suggestions?
TIA
jg

--
http://www.*-*-*.com/

We, in all humidity, are the people
of currant times. This concept grinds
our critical, seething minds to a halt.
                         ~~Anders Henriksson
                            "Life Reeked With Joy"



Mon, 23 Feb 2004 16:27:30 GMT  
 form input changed from Select to hidden, no errors and no search results

Quote:

>Hi,
>I'm working on modifying a the MSA Simple Search script for my site.  It's
>written in perl.  The bug I have encountered is that when I changed the
>boolean and case Select fields into hidden fields the script still runs
>without error but returns no results even though the results display the
>vars and they are the same whichever way I do it.  So the script is
>receiving the vars, putting them in into the mix but somehow then
>eliminating all the results.  I triple checked spelling and case between the
>2 setups and they match.
>Any suggestions?
>TIA
>jg

Post a small but complete code segment that exhibits the problem.
Maybe then we can see what is going on and make a suggestion.
--
    This space intentionally left blank


Mon, 23 Feb 2004 17:09:02 GMT  
 form input changed from Select to hidden, no errors and no search results
First off thanks for the response!
Per the request I am posting the pertinent bits.  I'm trying to be thorough
so I have included both versions of the html as well as the Search
subroutine which uses the vars in question (case and boolean) from the
script.  I'm sorry if I am clouding the issue:

Ok here is original version of html which works:

<form method=POST action="http://www.mysite.com/cgi-bin/search.pl">
<center><table border>
<tr>
<th>Text to Search For: </th><th><input type=text name="terms"
size=40><br></th>
</tr><tr>
<th>Boolean: <select name="boolean">
<option>AND
<option>OR
</select> </th> <th>Case <select name="case">
<option>Insensitive
<option>Sensitive
</select><br></th>
</tr><tr>
<th colspan=2><input type=submit value="Search!"> <input
type=reset><br></th>
</tr></table></center></form>

Here is modified version which *works* but never finds anything:

<form method=POST action="http://www.mysite.com/cgi-bin/search.pl">
<center>
    Text to Search For:
    <input type="hidden" name="boolean" value="AND">
    <input type="hidden" name="case" value="Insensitive ">
    <input type=text name="terms" size=40>
    <input type=submit value="Search!" name="submit">
  </center></form>

And here is the Search subroutine which uses the vars case and boolean:

sub search {



      open(FILE,"$FILE");

      close(FILE);


      $string =~ s/\n//g;
      if ($FORM{'boolean'} eq 'AND') {

            if ($FORM{'case'} eq 'Insensitive') {
               if (!($string =~ /$term/i)) {
                  $include{$FILE} = 'no';
      last;
               }
               else {
                  $include{$FILE} = 'yes';
               }
            }
            elsif ($FORM{'case'} eq 'Sensitive') {
               if (!($string =~ /$term/)) {
                  $include{$FILE} = 'no';
                  last;
               }
               else {
                  $include{$FILE} = 'yes';
               }
            }
         }
      }
      elsif ($FORM{'boolean'} eq 'OR') {

            if ($FORM{'case'} eq 'Insensitive') {
               if ($string =~ /$term/i) {
                  $include{$FILE} = 'yes';
                  last;
               }
               else {
                  $include{$FILE} = 'no';
               }
            }
            elsif ($FORM{'case'} eq 'Sensitive') {
               if ($string =~ /$term/) {
    $include{$FILE} = 'yes';
                  last;
               }
               else {
                  $include{$FILE} = 'no';
               }
            }
         }
      }
      if ($string =~ /<title>(.*)<\/title>/i) {
         $titles{$FILE} = "$1";
      }
      else {
         $titles{$FILE} = "$FILE";
      }
   }

Quote:
}

Thanks very much for your help!
jg
Quote:
----- Original Message -----

Newsgroups: comp.lang.perl.misc
Sent: Thursday, September 06, 2001 11:09 AM
Subject: Re: form input changed from Select to hidden, no errors and no
search results



> >Hi,
> >I'm working on modifying a the MSA Simple Search script for my site.
It's
> >written in perl.  The bug I have encountered is that when I changed the
> >boolean and case Select fields into hidden fields the script still runs
> >without error but returns no results even though the results display the
> >vars and they are the same whichever way I do it.  So the script is
> >receiving the vars, putting them in into the mix but somehow then
> >eliminating all the results.  I triple checked spelling and case between
the
> >2 setups and they match.
> >Any suggestions?
> >TIA
> >jg

> Post a small but complete code segment that exhibits the problem.
> Maybe then we can see what is going on and make a suggestion.
> --
>     This space intentionally left blank



Mon, 23 Feb 2004 20:51:31 GMT  
 form input changed from Select to hidden, no errors and no search results


Wed, 18 Jun 1902 01:00:00 GMT  
 form input changed from Select to hidden, no errors and no search results
Bizarre solution:  I erased the hidden fields and tried check boxes which
failed (initially checked or unchecked)  Then I tried text fields which
worked only if I entered the values not if the were displayed at runtime.
Finally I just erased it all and recoded.  Now it works.
Hope this helps someone in the future.
jg


Quote:
> First off thanks for the response!
> Per the request I am posting the pertinent bits.  I'm trying to be
thorough
> so I have included both versions of the html as well as the Search
> subroutine which uses the vars in question (case and boolean) from the
> script.  I'm sorry if I am clouding the issue:

> Ok here is original version of html which works:

> <form method=POST action="http://www.mysite.com/cgi-bin/search.pl">
> <center><table border>
> <tr>
> <th>Text to Search For: </th><th><input type=text name="terms"
> size=40><br></th>
> </tr><tr>
> <th>Boolean: <select name="boolean">
> <option>AND
> <option>OR
> </select> </th> <th>Case <select name="case">
> <option>Insensitive
> <option>Sensitive
> </select><br></th>
> </tr><tr>
> <th colspan=2><input type=submit value="Search!"> <input
> type=reset><br></th>
> </tr></table></center></form>

> Here is modified version which *works* but never finds anything:

> <form method=POST action="http://www.mysite.com/cgi-bin/search.pl">
> <center>
>     Text to Search For:
>     <input type="hidden" name="boolean" value="AND">
>     <input type="hidden" name="case" value="Insensitive ">
>     <input type=text name="terms" size=40>
>     <input type=submit value="Search!" name="submit">
>   </center></form>

> And here is the Search subroutine which uses the vars case and boolean:

> sub search {



>       open(FILE,"$FILE");

>       close(FILE);


>       $string =~ s/\n//g;
>       if ($FORM{'boolean'} eq 'AND') {

>             if ($FORM{'case'} eq 'Insensitive') {
>                if (!($string =~ /$term/i)) {
>                   $include{$FILE} = 'no';
>       last;
>                }
>                else {
>                   $include{$FILE} = 'yes';
>                }
>             }
>             elsif ($FORM{'case'} eq 'Sensitive') {
>                if (!($string =~ /$term/)) {
>                   $include{$FILE} = 'no';
>                   last;
>                }
>                else {
>                   $include{$FILE} = 'yes';
>                }
>             }
>          }
>       }
>       elsif ($FORM{'boolean'} eq 'OR') {

>             if ($FORM{'case'} eq 'Insensitive') {
>                if ($string =~ /$term/i) {
>                   $include{$FILE} = 'yes';
>                   last;
>                }
>                else {
>                   $include{$FILE} = 'no';
>                }
>             }
>             elsif ($FORM{'case'} eq 'Sensitive') {
>                if ($string =~ /$term/) {
>     $include{$FILE} = 'yes';
>                   last;
>                }
>                else {
>                   $include{$FILE} = 'no';
>                }
>             }
>          }
>       }
>       if ($string =~ /<title>(.*)<\/title>/i) {
>          $titles{$FILE} = "$1";
>       }
>       else {
>          $titles{$FILE} = "$FILE";
>       }
>    }
> }

> Thanks very much for your help!
> jg

> ----- Original Message -----

> Newsgroups: comp.lang.perl.misc
> Sent: Thursday, September 06, 2001 11:09 AM
> Subject: Re: form input changed from Select to hidden, no errors and no
> search results



> > >Hi,
> > >I'm working on modifying a the MSA Simple Search script for my site.
> It's
> > >written in perl.  The bug I have encountered is that when I changed the
> > >boolean and case Select fields into hidden fields the script still runs
> > >without error but returns no results even though the results display
the
> > >vars and they are the same whichever way I do it.  So the script is
> > >receiving the vars, putting them in into the mix but somehow then
> > >eliminating all the results.  I triple checked spelling and case
between
> the
> > >2 setups and they match.
> > >Any suggestions?
> > >TIA
> > >jg

> > Post a small but complete code segment that exhibits the problem.
> > Maybe then we can see what is going on and make a suggestion.
> > --
> >     This space intentionally left blank



Mon, 23 Feb 2004 23:23:22 GMT  
 form input changed from Select to hidden, no errors and no search results


Wed, 18 Jun 1902 01:00:00 GMT  
 form input changed from Select to hidden, no errors and no search results
[snip]

Quote:
>     <input type="hidden" name="case" value="Insensitive ">
[snip]
>             if ($FORM{'case'} eq 'Insensitive') {

In one place you have "Insensitive ", with a space on the end, and in
the other place you have 'Insensitive', with no space on the end.

The two are not equal.

--
"I think not," said Descartes, and promptly disappeared.



Thu, 26 Feb 2004 15:09:03 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Accesing hidden input forms

2. Accesing hidden input forms

3. Open file as a result of form input !!

4. Appending a simple form to end of Search results in pearl

5. Need help changing form input to leading caps on certain entries

6. Changing Form Input via Perl Script/Mail Script

7. Select Multiple Form Field via Perl into Oracle error

8. Hiding HTML results in a perl program

9. Passsing Input From Form 2 Form via Perl/CGI

10. hiding password on input

11. Hiding user input (e.g. passwords)

12. CGI Perl (with Hidden Input) Problem

 

 
Powered by phpBB® Forum Software