Reply to Re: php include problem

Your name:

Reply:


Posted by Toby A Inkster on 08/17/07 10:48

Heikki wrote:

> my index.php has link-menu in a right side, that opens something.php
> next to the menu.
>
> something.php has a link link-menu at the top of the page that should
> open stuff.php under this last menu.

Because $_GET['sivu'] can only ever take one value at a time, only one of
"something.php" or "stuff.php" can ever be included at once.

Try this in something.php:

<?php
$sivut2 = array('stuff','stuff2');

if (in_array($_GET['sivu2'], $sivut2))
{
include ($_GET['sivu2'] . '.php');
}
else
{
include('error.php');
}
?>

<a href="index.php?sivu=something&amp;sivu2=stuff">stuff</a>
<a href="index.php?sivu=something&amp;sivu2=stuff2">stuff2</a>


--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 57 days, 14:25.]

Elvis
http://tobyinkster.co.uk/blog/2007/08/16/elvis/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация