Código PHP:
<?php
$conexion = mysql_connect('localhost', 'root', '');
mysql_select_db('basededatos');
include('class.kpaginate.php') ;
?>
<html>
<head>
<title>Reporte de Propiedades</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-image: url(background.jpg);
}
.Estilo1 {color: #FFFFFF}
.Estilo7 {color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
.Estilo11 {
color: #990000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.Estilo12 {
font-size: 11px;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
}
.Estilo14 {
font-size: 5px;
color: #D4D4D4;
}
.Estilo16 {font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
-->
</style>
</head>
<body>
<div align="center"><img src="head-buscador.png" width="960" height="160"></div>
<form action="busquedapropiedades.php" method="get" name="form1" class="Estilo1">
<label>
<div align="center" class="Estilo7">
<table width="52%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<span class="Estilo16">Código</span><br>
<input name="txtBusqueda" type="text" class="Estilo12" id="txtBusqueda" style="width:110px; height:18px" value="<?php echo @$_GET['txtBusqueda']?>">
</td>
<td>
<span class="Estilo16">Rubro<br></span>
<select name="selRubro" class="Estilo12" id="selRubro" style="width:120px; height:18px">
<option value="-1" selected>Todas</option>
<?php
$tablarubro = mysql_query("SELECT * FROM rubro ORDER BY nombre ASC") or die(mysql_error()); // Seleccionamos las ciudades de la tabla ciudades
while($registrorubro = mysql_fetch_array($tablarubro)) { // Vamos a repetir una Option (opcion), de la Lista Desplegable, por cada ciudad en la tabla
?>
<option value="<?php echo $registrorubro['id']; ?>" <?php echo (@$_GET['selLinea'] == $registrorubro['id'] ? 'selected' : false)?>><?php echo $registrorubro['nombre']; ?></option>
<?php
} // termina la zona de repeticion
mysql_free_result($tablarubro); // se libera la memoria usada por la tabla
?>
</select>
</td>
<td>
<span class="Estilo16">Marca<br></span>
<select name="selMarca" class="Estilo12" id="selMarca" style="width:120px; height:18px">
<option value="-1" selected>Todas</option>
<?php
$tablamarca = mysql_query("SELECT * FROM marca ORDER BY nombre ASC") or die(mysql_error()); // Seleccionamos las ciudades de la tabla ciudades
while ($registromarca = mysql_fetch_array($tablamarca)) { // Vamos a repetir una Option (opcion), de la Lista Desplegable, por cada ciudad en la tabla
?>
<option value="<?php echo $registromarca['id']; ?>" <?php echo (@$_GET['selLinea'] == $registromarca['id'] ? 'selected' : false)?>><?php echo $registromarca['nombre']; ?></option>
<?php
} // termina la zona de repeticion
mysql_free_result($tablamarca); // se libera la memoria usada por la tabla
?>
</select></td>
<td>
<span class="Estilo16">Modelo<br></span>
<select name="selModelo" style="width:120px; height:18px" id="selModelo">
<option value="-1" selected>Todas</option>
<?php
$tablamodelo = mysql_query("SELECT * FROM modelo ORDER BY nombre ASC") or die(mysql_error()); // Seleccionamos las ciudades de la tabla ciudades
while ($registromodelo = mysql_fetch_array($tablamodelo)) { // Vamos a repetir una Option (opcion), de la Lista Desplegable, por cada ciudad en la tabla
?>
<option value="<?php echo $registromodelo['id']; ?>" <?php echo (@$_GET['selLinea'] == $registromodelo['id'] ? 'selected' : false)?>><?php echo $registromodelo['nombre']; ?></option>
<?php
} // termina la zona de repeticion
mysql_free_result($tablamodelo); // se libera la memoria usada por la tabla
?>
</select>
<input name="cmdBuscar" type="submit" class="Estilo12" id="cmdBuscar" style="width:50px; height:18px" value="Buscar">
<input name="cmdBuscar2" type="reset" class="Estilo12" id="cmdBuscar2" style="width:50px; height:18px" value="Limpiar">
</td>
</tr>
</table>
</div>
</label>
<div align="center"></div>
</form>
<div align="center">
<table width="52%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" align="center" valign="top"><img src="http://www.distrisurweb.com.ar/imagenes/piclat2.jpg" alt="p0"/></td>
<td width="80%" valign="top"><table width="447" height="94" border="0" cellpadding="0" cellspacing="0">
<?php
$condiciones = "" ;
if (isset($_GET['selRubro']) && $_GET['selRubro'] != -1) {
$condiciones .= " AND r.id = " . $_GET['selRubro'];
}
if (isset($_GET['selMarca']) && $_GET['selMarca'] != -1) {
$condiciones .= " AND m.id = " . $_GET['selMarca'];
}
if (isset($_GET['selModelo']) && $_GET['selModelo'] != -1) {
$condiciones .= " AND a.id = " . $_GET['selModelo'];
}
if (isset($_GET['txtBusqueda'])) {
$condiciones .= " AND p.titulo LIKE '%" . $_GET['txtBusqueda'] . "%'";
}
$sql_count = "SELECT COUNT(*) FROM producto p ";
$sql_count .= "LEFT JOIN rubro r ON r.id = p.idrubro ";
$sql_count .= "LEFT JOIN marca m ON m.id = p.idmarca ";
$sql_count .= "LEFT JOIN marca a ON a.id = p.idmodelo ";
$sql_count .= "WHERE 1" . $condiciones;
$count_result = mysql_query($sql_count);
$total_productos = mysql_result($count_result, 0, 0) ;
$kpaginate = new kpaginate ;
$kpaginate->setTotalItems($total_productos) ;
$kpaginate->setItemsPerPage(5) ;
$limit = $kpaginate->getLimit() ;
$sql = "SELECT * FROM producto p ";
$sql .= "LEFT JOIN rubro r ON r.id = p.idrubro ";
$sql .= "LEFT JOIN marca m ON m.id = p.idmarca ";
$sql .= "LEFT JOIN marca a ON a.id = p.idmodelo ";
$sql .= "WHERE 1" . $condiciones ;
$sql .= " ORDER BY p.id DESC LIMIT " . current($limit) . ", " . end($limit) ;
$tabla = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($tabla) > 0) {
while ($registro = mysql_fetch_array($tabla)) {
?>
<tr>
<td width="86" height="85" align="center" class="Estilo1"><img src="http://www.distrisurweb.com.ar/imagenes/productos.jpg" alt="001P"/> </td>
<td width="234" valign="top" class="Estilo1"><p><span class="Estilo11"><span class="Estilo14">a</span><br>Artículo
<?php echo $registro['titulo']; ?><br>
</span><span class="Estilo7"><?php echo $registro['descripcion']; ?></span><br><br></p></td>
<td width="144" align="right" valign="top" class="Estilo1">
<span class="Estilo7">
<span class="Estilo11">
<span class="Estilo14">a</span>
</span>
<br>
Precio: $ <?php echo $registro['precio']; ?>
</span>
</td>
</tr>
<?php
}
$kpaginate->paginate() ;
} else {
echo "No se encontraron resultados";
}
mysql_free_result($tabla);
mysql_close($conexion);
?>
</table></td>
</tr>
</table>
</div>
</tr>
</body>
</html>
Bueno ahí te va el nuevo código, cambié el method post por get, para filtros y búsquedas SIEMPRE es mejor con get, recuerda incluír correctamente la clase kpaginate, no lo he probado pero espero que te sirva.
Saludos!