2
I made this condition, so that if the person searches by name Andrey will run a require, otherwise it will not display, so any name I put in the search field is bringing the require, so is my code:
if ($resultados->num_rows > 0) {
while($linha = mysqli_fetch_array($resultados)) {
echo utf8_encode("<strong>Nome: </strong>" . $linha['nome'] . "</br>");
print ("<strong>Endereço: </strong>" . $linha['endereco']."</br>");
if( isset($_POST['cidade']) && $_POST['cidade'] === 'sao-gabriel-da-palha' ) {
$fromPerson = 'São Gabriel da Palha';
echo "<strong>Cidade: </strong>".$fromPerson."</br>";
}
print ("<strong>Telefone: </strong>" . $linha['telefone']."</br>");
echo "<strong>email: </strong>". $linha['email']."</br>";
if (isset($_POST['nome']) === 'Andrêy Ferraz' || 'Andrêy' || 'Ferraz' || 'Andrey'){
require 'andreyferraz.php';
}
}
} else {
echo "Nenhum resultado para a sua busca.";
}
$conexao->close();
See that in the code you compare
$_POST['nome']
This seems not to exist the correct would be$_POST['palavra']
nos if. Need to clarify this.– rray
I put 'word' and still not bringing the require... my ours getting crazy with it already
– WPfan
I edited the answer with the correction.
– rray
Dude, I don’t get it, the require only works if I put it on LSE, but whatever I look for ends up displaying it
– WPfan
Before you were comparing the wrong values there was no field called
nome
in your form (html) there$_POST['nome'] == 'algo'
will always returnfalse
. You need to define what you want to compare.– rray
yes, but I switched for word and solved nothing
– WPfan
There must be a problem elsewhere in the code, because the comparison is what is in the answer. Need to do a thorough debug now, print the value of the variables check where the code passes.
– rray