Hola a todos tengo un buscador sencillo asi:
Código HTML:
<form id="form1" name="form1" method="get" action="buscar.php">
<td valign="middle"> <font size="2">Nombre: </font></td>
<input type="text" name="nombre" id="nombre" />
</label>
<label>
<input type="submit" name="buscar2" id="buscar2" value="Buscar" />
</label>
</form>
Código PHP:
$colname_alumnos = "1";
if (isset($_GET['nombre'])) {
$colname_alumnos = $_GET['nombre'];
}
$query_alumnos = sprintf("SELECT
*
FROM alumnos
where Nombre like %s
", GetSQLValueString("%" . $colname_alumnos . "%", "text"),
$alumnos = mysql_query($query_alumnos, $connection) or die(mysql_error());
$row_alumnos = mysql_fetch_assoc($alumnos);
$totalRows_alumnos = mysql_num_rows($alumnos);
Funciona perfecto
Ahora estoy tratando de implementar lo siguiente
Código HTML:
<form id="form1" name="form1" method="get" action="buscar.php">
<td valign="middle"> <font size="2">Buscar por: </font><select name="buscarpor" style="width:135px">
<option value="Matricula">Matricula</option>
<option value="Nombre">Nombre</option>
<option value="ApellidoPaterno">Apellido Paterno</option>
</select></td>
<input type="text" name="nombre" id="nombre" />
</label>
<label>
<input type="submit" name="buscar2" id="buscar2" value="Buscar" />
</label>
</form>
Pero no tengo idea de como expresar en mi consulta la variabe que se eligio en el select
Gracias otra vez :)