Good afternoon,
Edited:
From what I noticed you want to give an alert to the user that what he sought was not found. You must have a page like www.lovedevelopment.com.br/vusca.php?q=0 (q = 0 because you did not find the result). In this case we will see how it would look in php.
<?php
//Analisando o caso com a URL ww.lovedevelopment.com.br/vusca.php?q=0
//vamos primeiro colocar em uma variável o resultado
$testa_minha_busca = $_GET['q'];
//Depois vamos testar se o resultado veio igual a 0
if ( $testa_minha_busca == 0 ) {
//Se for encontrado vamos mandar um alerta
echo "<script>alert('Sua busca tá osso man!');</script>";
// Em seguida vamos mandar ele para home e 3 segundos
header( "refresh:3;url=home.php" );
}
?>
I saw one of the tips they gave you was using AJAX. Let's first go to the principles of using this "Disinfectant".
What is it?
Method that opens a window to pass information from client-side to Server-side.
And when do I use this?
I want to store my data in a mysql database and I have a file that inserts this into the bank an insert.php only the data is coming from a client-side form and I do not want to use PHP's POST.
Let's look at an example in a search. I have a file that calls check_de_busca.php and I want but I want the search to be dynamic and without reload, and the data comes from the javascript. And when the result is null it returns what this file calls check_de_busca.php.
<script>
$(document).ready(function() {
//Quando clicar na busca
$('botao_buca').click(function() {
//chama o AJAX
$.ajax({
//vamos postar
type: "post",
//Para o Arquivo abaixo
url: "check_de_busca.php",
//A variável do javascript que eu quero passar para o PHP é termo de busca
data: "busca"+termo_de_busca,
//Asynchrono
async: true,
//Se ele der sucesso da requisição e for 0 avisa os truta
success: function(result) {
if (result == 0) {
alert('Sua busca tá osso man!');
}
},
});
});
});
</script>
Just adjust your variables and Divs. And an additional interface tip, if you're sending an alert ( link ).
Thanks,
I am available