I'm not sure if the title here is appropriate and my explanation might be just as bad but here it goes... I am using the following code to generate web pages:
source: Dynamic inclusion in PHP
<?php
$id = $_GET['id'];
$display = $_GET['display'];
$displays = array('page1', 'page2', 'page3', 'page4', 'page5&id=$id');
if (!empty($display)) {
if(in_array($display,$displays)) {
$display .= '.php';
include($display);
}
else {
echo 'Page not found. Return to
<a href="index.php">Index</a>';
}
}
else { //show html
?>
a typical page:
www.website.com/dir/index.php?display=page4
My problem is this: I want to add a page to the array of allowed pages that has a dynamic value. You can see my attempt at this in the code above where i added: 'page5&id=$id'
However when i go to this page:
www.website.com/dir/index.php?display=page5&id=2
I get the error message "Page not found. Return to Index". (The table row id with value of 2 does exist in the database.)