Posted: Sat Oct 11, 2003 11:08 am
I will definitely end up using that in the future genik, thanks man.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?
$id =$_GETї'id'];
if(isset($id)) // checks if 'id' was part of the link // checks if 'id' was part of the link
{
if(file_exists("page".$id.".php")) // checks if the page exists
{
include("page".$id.".php"); // includes the page
}
else
{
echo("Page not found."); // gets shown if the page doesn't exist
}
}
else
{
echo("No page requested."); // gets shown if 'id' wasn't part of the link
}
$c =$_GETї'c'];
if(isset($c)) // checks if 'id' was part of the link // checks if 'id' was part of the link
{
if(file_exists("side".$c.".php")) // checks if the page exists
{
include("side".$c.".php"); // includes the page
}
else
{
echo("Page not found."); // gets shown if the page doesn't exist
}
}
else
{
echo("No page requested."); // gets shown if 'id' wasn't part of the link
}
?>Code: Select all
<?php
foreach($_GET as $var => $value) { ${$var} = $value; }
?>Code: Select all
<?php
foreach($_POST as $var => $value) { ${$var} = $value; }
foreach($_SESSION as $var => $value) { ${$var} = $value; }
?>Yeah that's about the size of it.md702 wrote:what if you wanted to include 2 different pages as part of the link, what would the index page look like?
like: http:///something.com/index.php?menu=1&id=5
where it would load menu 1 page and page5
Your code looks ok (I've cleaned it up a bit) so the best thing to do is just to test it really. If you are sending ID= and MENU= via the link remeber that those are the names of the variables you will need to use.md702 wrote:could you review the code Gen-ik:) TY!
Code: Select all
<?php
$id = $_GET['id'];
if(isset($id))
{
if(file_exists("page".$id.".php"))
{
include("page".$id.".php");
}
else
{
echo("Page not found.");
}
}
else
{
echo("ID was not set.");
}
$menu = $_GET['menu'];
if(isset($menu))
{
if(file_exists("side".$menu.".php"))
{
include("side".$menu.".php");
}
else
{
echo("Menu not found.");
}
}
else
{
echo("MENU was not set.");
}
?>