tags:

views:

134

answers:

2

Is there a way to run a second PHP file from the first file ?

example i wam running a.php and from the foreach loop, the var is past to b.php using POST function..

+2  A: 

You can always use include and you do not have to POST a variable, an included PHP file runs in the same scope as the including file (there's no HTTP request being made).

Marcel Korpel
+2  A: 

You don't need to pass it with GET. You can just use include('path/to/file.php'). That calls that file, and PHP acts as though the contents of that file were right there in the current one.

Jonah Bron
Note that you do not necessarily need the parentheses, `include` is a language construct, just like `echo` (even if it is listed as function on php.net). Have a look at the examples on http://php.net/manual/en/function.include.php
soulmerge