0
I’m trying to create a more dynamic way to load the pages I’m using, loading files like CSS on just one page, and from that page, calling others. However, I cannot receive the value I am going through the URL. Follow the sending code:
<div id='navbar' class='navbar-collapse collapse'>
<ul class='nav navbar-nav'>
<li class='dropdown'>
<a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='0false'>Ofícios<span class='caret'></span></a>
<ul class='dropdown-menu'>
<li class='dropdown'>
<a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'>Funcionário<span class='caret'></span></a>
<ul class='dropdown-menu'>
<li><a href='funcionario_cadastrar.php?link=17'>Cadastrar</a></li>
<li><a href='funcionario_listar.php?link=18'>Listar</a></li>
<li><a href='funcionario_consultar.php?link=19'>Consultar</a></li>
</ul>
</li>
</ul>
</li>
</ul>
And the receipt:
$link = $_GET["link"];
print_r($_GET["link"]);
if(isset($_GET["link"])){
/*
$pagina[17] = "funcionario_cadastrar.php";
$pagina[18] = "funcionario_listar.php";
$pagina[19] = "funcionario_consultar.php";
if(!empty($link)){
if(file_exists($pagina[$link])){
include $pagina[$link];
}else{
include "bem_vindo.php";
}
}else{
include "bem_vindo.php";
}
}else{
include "bem_vindo.php";
*/
}
The
isset()
should be done directly on$_GET
. When in doubt doprint_r($_GET);
– rray
Here it works normally, if I access the page containing the link, while being redirected it will start the variable
$link
, now if I try to directly access the page that picks up the link gives an error, explain better what you are doing and if possible put the full code of the page with the link, it may be something else...– MagicHat
I edited the publication with the rest of the code.
– Lucas Ramos
Something comes up from
print_r()
?– rray
No, I tried to put in and out of the if to see if there was a difference, but it continued showing nothing.
– Lucas Ramos
you have apache installed?
– rray
Yes, I use the Apache2.
– Lucas Ramos
The code seems to work, is it not sending to the wrong file? Leaves your file that gets only so, see if something appears.
echo (isset($_GET["link"]) ? $_GET["link"] : 'nada');
– rray
This time the message appeared "nothing".
– Lucas Ramos