Hello
I have a question. I would like to create a file outside the menu of a website that is responsible for linking the pages, but I am having a lot of difficulty in running it. I'm starting with PHP now ...
For example:
My menu has:
<a class="nav-link" href="./r.php?codigo=0" id="hl">Home</a>
<a class="nav-link" href="./r.php?codigo=1" id="hl">Quem Somos</a>
<a class="nav-link" href="./r.php?codigo=2" id="hl">Textos</a>
<a class="nav-link" href="./r.php?codigo=3" id="hl">Contato</a>
In the r.php file I'm using the superglobal $ _GET to get this information:
<?php
$link = $_GET['codigo'];
$endereco = array("./index.php","./quemsomos/index.php","./textos/index.php","./contato/index.php");
header('location: ' . $endereco[$link]);
?>
The first works because the r.php file is in the root folder, next to the first index.php. Others can not find the file and I'm having trouble doing so.
I had read that the './' searches from the root folder of the application, but it is not working. Any tips?
Thank you in advance.