Jump to content


Photo

include or require a php file with query string?


  • Please log in to reply
2 replies to this topic

#1 MarkMan5

MarkMan5
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 05 April 2006 - 11:30 PM

How can I, or is it possible, to 'include' or 'require' a php page and send a query string as well?

ex:
include $_SERVER['DOCUMENT_ROOT']."/help_page.php?table=gen_help";

thanks!

#2 Hooker

Hooker
  • Members
  • PipPipPip
  • Advanced Member
  • 193 posts
  • LocationWales, UK

Posted 06 April 2006 - 12:47 AM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Example 16-7. include() through HTTP
<?php

/* This example assumes that www.example.com is configured to parse .php
* files and not .txt files. Also, 'Works' here means that the variables
* $foo and $bar are available within the included file. */

// Won't work; file.txt wasn't handled by www.example.com as PHP
include 'http://www.example.com/file.txt?foo=1&bar=2';

// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';

// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';

$foo = 1;
$bar = 2;
include 'file.txt'; // Works.
include 'file.php'; // Works.

?> [/quote]

:)

#3 MarkMan5

MarkMan5
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 06 April 2006 - 06:37 AM

Sweet! It works now, thanks. I knew it was going to be an easy fix.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users