Entendi el funcionamiento del <option>
y el codigo me quedo asi....
Código PHP:
<?php
$conexion = mysql_connect('localhost', 'pablo', 'pablo');
mysql_select_db('propiedades');
?>
<html>
<head>
<title>Reporte de Propiedades</title>
</head>
<body>
<h1>Búsqueda de Propiedades</h1>
<form name="form1" method="post" action="busquedapropiedades3.php">
<label>Buscar:
<input type="text" name="txtBusqueda" id="txtBusqueda">
Ciudad:
<select name="selCiudad" size="1" id="selCiudad">
<option value="-1" selected>Todas</option>
<?php
$tablaciudades = mysql_query("SELECT * FROM ciudades ORDER BY nombre ASC");
while ($registrociudad = mysql_fetch_array($tablaciudades)) {
?>
<option value="<?php echo $registrociudad['idciudades']; ?>" ><?php echo $registrociudad['nombre']; ?></option>
<?php
}
mysql_free_result($tablaciudades);
?>
</select>
</label>
<input type="submit" name="cmdBuscar" id="cmdBuscar" value="IR">
</form>
<table border="1">
<tr>
<td>ID Propiedad </td>
<td>Propiedad</td>
<td>Ciudad</td>
<td>Metros 2</td>
<td>Precio</td>
</tr>
<?php
$sql = "SELECT p.idpropiedades, p.ciudades_idciudades, p.tipo, p.m2, p.valor, c.nombre
FROM propiedades p, ciudades c
WHERE p.ciudades_idciudades=c.idciudades";
if (isset($_POST['txtBusqueda'])) {
$sql .= " AND p.tipo LIKE '%" . $_POST['txtBusqueda'] . "%' ";
if (intval($_POST['selCiudad']) > 0) {
$sql .= " AND p.idciudades = '" . intval($_POST['selCiudad']) . "'";
}
}
$sql .= " ORDER BY c.nombre ASC";
$tabla = mysql_query($sql);
while ($registro = mysql_fetch_array($tabla)) {
?>
<tr>
<td><?php echo $registro['idpropiedades']; ?></td>
<td><?php echo $registro['tipo']; ?></td>
<td><?php echo $registro['nombre']; ?></td>
<td><?php echo $registro['m2']; ?></td>
<td><?php echo $registro['valor']; ?> </td>
</tr>
<?php
}
mysql_free_result($tabla);
mysql_close($conexion);
?>
</table>
</body>
</html>
pero sigue un problema, y es que al cliquear en la ciudad escojida desde el listbox...me muestra un error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\localhost\AppServ\www\prueba de archivos\Base Datos\busquedapropiedades3.php on line 51
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\localhost\AppServ\www\prueba de archivos\Base Datos\busquedapropiedades3.php on line 62
Gracias