OK here goes...
A. if ($initiative = 'on') assigns variable and returns true it does not evaluate try  if ($initiative eq 'on')
B. What are the checkboxes returning? would s/\W//g be more effective stripping non word charecters?
C. If you are using checkboxes rather than radio boxes then multiple ones can be checked.
my $hash ={ Initiative=>'DriveInitiative', ResOrientation => 'DriveResOrient'}; my @clauses = (); foreach my $checkbox (keys %$hash) { push @clauses, $hash->{$checkbox} if validate($cgi->param($checkbox +)); } my $where_clause = join(' and ',map($_.'= 'on', @clauses)); my $sql = "select a.ResType, a.ResLevel, a.ResManage a.Details, a.Length, a.Source, a.Cost, a.FurtherDeta +ils from Resources a INNER JOIN ResourceSettings b ON a.ResID = b.ResID"; $sql .= " where $where_clause " if ($where_clause); $sql .= " order by a.ResType, a.ResLevel, a.ResManage, a.Details, a.Length, a.Source, a.Cost, a.FurtherDetail +s";

Code is untested:(
Hope this helps
UnderMine

In reply to Re: querying a database using checkbox values by UnderMine
in thread querying a database using checkbox values by Rachel

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.