I've been looking for a way to do the typical search in the navigation bar but this time using a button with the appearance of a link, I intend to make a MercadoLibre type filter
This is my code:
<?php session_start();
require 'extras/config.php';
require 'functions.php';
comprobarSession();
$conexion = conexion($bd_config);
if (!$conexion) {
header('Location: error.php');
}
if ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_GET['1000'])) {
$busqueda = limpiarDatos($_GET['1000']);
$statement = $conexion->prepare('SELECT * FROM publications WHERE salario LIKE :1000');
$statement->execute(array(':1000' => "%$busqueda%"));
$resultados = $statement->fetchAll();
print_r($statement);
if(empty($resultados)){
$titulo = 'No se encontraron articulos con el resultado '. $busqueda;
} else {
$titulo = 'Resultados de la busqueda: ' . $busqueda;
}
}
require 'views/1000+.php';
?>
and my button is this:
<form action="1000+.php" method="GET">
<input type="submit" class="btn btn-link" value="$1,000+">$1,000+</input>(16947)
</form>