Can someone help?
I need help building a statement to return all vehicle types either "For Sale" or "For Rent" when all vehicles are selected.
Also i added a hide region but it returns nothing can someone help please? The total records displays ok but i get nothing in the repeat region.
Thanks in advanced
Here is the code:
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'])) { // Use $_POST, not $HTTP_POST_VARS
$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 if ($totalRows_rsTest == 0) { // Show if recordset empty ?>
<?php do { ?>
<div class="output" id="Results">
<p><?php echo $row_rsTest['year']; ?></p>
<p><?php echo $row_rsTest['model']; ?></p>
</div>
<?php } while ($row_rsTest = mysql_fetch_assoc($rsTest)); ?>
<?php } // Show if recordset empty ?>
hide region not working
Moderator: General Moderators
Re: hide region not working
The way you have it coded, the "repeat region" you have only works if there are no results from the query.
-Greg
-Greg
Re: hide region not working
What do i need to do to get the code to work? I tried moving the if statement but no luck i either get all the records or none of the records when my search criteria returns nothing
Re: hide region not working
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 you help me?