0

I want to use query strings into include function, like include('where.php?id=1'); and echo $_REQUEST in where.php; but gives error.

Warning: include(where.php?id=1) [function.include]: failed to open stream: No error in C:\xampp\htdocs\3g\include.php on line 2

Warning: include() [function.include]: Failed opening 'where.php?id=1' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\3g\include.php on line 2

If yes, then how?
If not, then alternate solution.

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by almostbob
0

I believe passing a query string to the included file is functionally unneccessary

the included file becomes part of the outer/wrapper/including/calling file //you choose an appropriate description
all the values known to the outer file are known to the included file

if id is given in a query string to the outer file, the value is available to the included file as $_request
if $id is calculated in the outer file, the value of $id is available to the included file as $id

<?php // Outer.php
include(where.php); ?>
<? //where.php
if isset($_request['id']) {echo $_request['id'];} ?>

outer.php?id=wassup_dude outputs to the screen

wassup_dude

Edited by almostbob: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.