I have 7 different pages. All pages are the same considering the layout, but are different considering the content. The content is provided by a database, depending on what the users click on.
I figured out you have to pass the variable using the URL, and by so defining which content to load, right?
So, this is my menu-item:
<a id="menupag" class="item1" href="index.php?page=groups?group1">
This is my index:
<div class="content">
<?php
include_once ('content/'.$_GET['page'].'.php');
?>
</div>
But for some reason, when I click on the menu-item, this message appears:
Warning: include_once(content/groups?group1.php): failed to open stream: No such file or directory in httpd.www/new/index.php on line 32
What do I have to do to let php ignore the last part of the URL (this part is only used to define which data the database has to return) and just listen to the index.php?page=groups?
You pass parameters in URL in a bad way:
You should change it into:
so you will have in
$_GETsuperglobal two values:However using:
is totally unsafe. The better solution is: