You are here: Re: open or output the script with arguments « PHP Programming Language « IT news, forums, messages
Re: open or output the script with arguments

Posted by Rik Wasmus on 02/01/08 15:06

On Fri, 01 Feb 2008 15:58:41 +0100, bobo <fourtwentybh@yahoo.com> wrote:=


> I need something like include("first.php?id=3D1")...
>

You don't. $_GET variables are available in the included script:


URL: first.php?id=3D2
first.php
<?php
include 'second.php';
?>
second.php
<?php
echo $_GET['id'];//outputs '2'
?>

Now, if you need the _change_ the GET variable in between, there is =

something wrong with the logic, but we can work around that:

URL: first.php?id=3D2
first.php
<?php
$id =3D 3;
include 'second.php';
?>
second.php
<?php
$id =3D isset($id) ? $id : $_GET['id'];
echo $id;//outputs '3'
?>
-- =

Rik Wasmus

 

Navigation:

[Reply to this 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

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