SEARCH PAGE: <form id="searcMennuu" name="searcMennuu" method="post" action="VehicleListing.php"> <select name="vehicles" id="vehicles"> <option value="allCars" selected="selected">ALL</option> <option value="Sedan">Sedan</option> <option value="Jeep">Jeep</option> <option value="Motorbike">Motorbike</option> </select> <input name="radioVehicle" type="radio" id="searchSale" value="searchSale" /> Vehicles for Sale</label> <label> <input type="radio" name="radioVehicle" id="searchRent" value="searchRent" /> Vehicles for Rent</label> <input type="submit" name="searchButton" id="searchButton" value="Search" /> </form> RESULTS PAGE: mysql_select_db($database_ddd, $ddd); $query_rsTest = "SELECT `year`, `model` FROM vehicles"; if (isset ($_POST ['vehicles'])) { $parSearch = mysql_real_escape_string ($_POST['vehicles']); if($_POST['vehicles'] == "Sedan"){ $query_rsTest.= " WHERE vehicle_type LIKE '%$parSearch%'"; } } $rsTest = mysql_query ($query_rsTest, $ddd) or die(mysql_error()); $row_rsTest = mysql_fetch_assoc ($rsTest); $totalRows_rsTest = mysql_num_rows ($rsTest); <div class="showPage"><?php echo $totalRows_rsTest ?></div> <?php do { ?> <?php if ($totalRows_rsTest > 0) { // Show if recordset not empty ?> <div class="output" id="Results"> <p><?php echo $row_rsTest['year']; ?></p> <p><?php echo $row_rsTest['model']; ?></p> </div> <?php } // Show if recordset empty ?> <?php } while ($row_rsTest = mysql_fetch_assoc($rsTest)); ?> 1. I think i found out why the hide region is not working, whenever i search for something that is not in my database or does not satisfy my search criteria the results page is displaying all records in the database. However i don't know how to fix that. Can someone please help me? 2. Also i'm trying to find out how i would display ALL vehicles in my database either for rent or sale, i dont have a field in my database for "ALL" so i'm not sure where to start. Thanks in advance
For the second question just do: WHERE `type` = `rent` OR `type` = `sale` or WHERE `type` IN (`rent`, `sale`) For the first question, you need to make sure that you always have a WHERE x = x part of the query what subset of the data you are searching for.
I understand the first part actually make some much sense. Could you explain the second part of your answer using code, it's easier to follow. I dont understand what u mean by "subset". Thanks you are helping