I think it's not a mistake, but a structure in the page checks recently adapted a friendly URL on my site, then I decided to implement a search system with ajax, on the site it works right as you can see in the image
ButwhenIgotoanotherpageofthesiteandtrytodoasearch,itaddsbusca.php
andbugaallmypageastheimage
Doesanyoneknowwhat'sgoingon?
index.php
include_once("sql/config.php");
if(isset($_GET['url'])){
$url = $_GET['url'];
$urlE = explode('/',$url);
}
if(isset($urlE[0])){
$arquivo = $urlE[0];
}elseif(isset($urlE[0]) || isset($urlE[1])){
$arquivo = $urlE[0];
$post = $urlE[1];
}
$paginas = array('contato');
//verifica se a pagina existe no meu diretorio
if(isset($arquivo) && in_array($arquivo,$paginas)){
include_once "includes/$arquivo.php";
echo "aqui";
}
//se nao existir nada na minha url, manda para a home
elseif(!isset($urlE[0])){
include_once "includes/home.php";
echo "aqui home";
}
//caso nao exista no meu diretorio, mais esteja cadastrado no banco de dados
else{
include_once "includes/generos.php";
echo "aqui generos";
}
is falling on if calling the generos.php page
I changed my last else
even though it did not work
else{
if($urlE == 'busca'){
}else{
include_once "includes/generos.php";
echo "aqui generos";
}
}
Before I was just calling my pages with include
I thought the problem was this, I researched it and found here an explanation about include
, include_once
, require
and require_once
that maniero did, I changed everything to include_once
, but did not solve my problem