1
I need to pass a value to a page that’s on one include_once
, but I don’t know how to solve:
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 directory /includes/users/.
The code below does not redirect to page edit.php
only recharges the 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’t do is that page edit.php
is loaded into include when it is set to ex: index.php?p=includes/users/edit.php?id=25
. No parameter to page edit.php
charges normally.
I imagine I should add something to the include code, but I haven’t found the solution yet.
If that’s what I understand, you can use the function header() to redirect to the page.
– Franchesco
Who voted as impossible to reproduce or typo at least tried to understand the question?
– Bruno Augusto
@Brunoaugusto I did not vote and honestly did not understand anything, neither the question nor the answer...
– Jorge B.