My problem is as follows, when I make a query, the number 1 appears in the input automatically, does anyone know why?
Attached image.
Here is the Code - PHP
<?php
include 'conexion.php';
?>
<form action="buscador.php" method="POST">
<input type="text" name="palabra" placeholder="buscar aqui.." value="<?php
echo(isset($_POST["palabra"])); ?>" oNclick="this.value=''"; />
<input type="submit" name="buscador" value="Buscar" id="buscar" />
<style type="text/css">
#buscar{
display: none;
}
</style>
</form>
<?php
if(isset($_POST['buscador'])){
$buscar = $_POST['palabra'];
if (empty($buscar)){
echo "No se ha ingresado ninguna palabra";
}
else
{
$sql = "SELECT * FROM peliculas WHERE nombre LIKE '%$buscar%'";
$result = $conexion->query($sql);
$total = mysqli_num_rows($result);
if ($row = mysqli_fetch_array($result)) {
echo "Resultados para: $buscar";
?>
<br>
<?php
do {
?>
<br>
<br>
<a href="<?php echo $row['link'] ?>">(nombre: <?php echo $row['nombre']; ?>)</a>
<?php
}
while ($row = mysqli_fetch_array($result));
}
else
{
echo "No se encontraron resultados para: $buscar";
}
}
}
?>