I need to pass a value to a page that is in include_once
, but I do not know how to solve it:
The code I'm using for includes is in the main directory:
<?php
if (isset($_GET["p"])){
if (file_exists($_GET["p"])){
include_once($_GET["p"]);
} else {
include_once("main.php");
}
} else {
include_once("main.php");
}
?>
And the page I want to call via $ _GET is inside the / includes / users / directory.
The code below does not redirect to page edit.php
only reload main.php
.
echo "<td><a class='uk-button' href='index.php?p=includes/users/edit.php?id=$id'><i class='uk-icon-cog'></i> Edit</a>
<a class='uk-button uk-button-danger' href='#'><i class='uk-icon-trash'></i> Delete</a></td>";
What I can not do is that the edit.php
page is loaded inside the include when it has parameter ex: index.php?p=includes/users/edit.php?id=25
. Without parameter the page edit.php
loads normally.
I guess I should add something to the include code, but I have not found the solution yet.