how to include one page into another;
for example page 1 include page 2. page 2 does not show any content until it get the right arguments.
this is page 2 direct url call
www.mypage.com/execute.php?cmd=test
output is hello world
but when include the same page into page 1 like
include('execute.php?cmd=test');
or
$_GET['cmd']=$test;
include('execute.php');
sorry but i think you guys didn’t understand me quite right. what im trying to do is, page 2 have some content which must be displayed only when its needed so therefore is have created a function in page 2 so I can call it. the content of must be viewed on page 1 by call. so i have tried to do which normally works ‘execute.php?cmd=test’ but its not this time
While I think I understand what you’re trying to do, it is the wrong approach. Use a third PHP script that both your pages will include. This way, you won’t have to hack the
$_GETsuper global variable.includes/somescript.php
page1.php
page2.php
Of course, the file
includes/somescript.phpshould not just be executed like that, it should contain afunctionor a class with arguments that you include, then invoke from your pages. Up to you if you’re going OO or procedural with this.Procedural
includes/somescript.php
page1.php
Object Oriented
includes/somescript.php
page2.php