I have a form that I need to submit to a search page and I want the search script to NOT return records where "active" = 0. (active can only be 1 or 0). The problem is that the active variable which I am passing in the hidden input below is either not the correct way to pass this variable, or else the search script is not correctly processing the active variable on the search page. Can anyone see what the active variable is being ignored when returning my results?
//The search form
<form name="search" method="get" action="http://example.com/searchb/">
<p> </p>
Category:
<select name="category">
<?php foreach($categories_list as $category) : ?>
<option><?php echo $category; ?></option>
<?php endforeach; ?>
</select>
<p> </p>
Keywords:
<input type="text" name="keywords">
<input type="hidden" name="active" value="0">
<input type="submit"/>
</form>
//some relevant code from the search.php script:
$category = $_GET['category'];
$active = $_GET['active'];
try {
$where_sql .= " AND s.category = '".$category."'";
if(empty($active) == false) {
$where_sql .= " AND s.active = '".$active."'";
}
// Find out how many items are in the table
$total = $dbh->query("SELECT COUNT(*) FROM searching s WHERE 1
{$where_sql}")->fetchColumn();