Page 1 of 1

Can you query the URL without an INC file?

Posted: Thu Jul 23, 2009 6:49 am
by simonmlewis
I need pass the ID number of a person to a PHP page.

Normally I would do this:

Code: Select all

index.php?page=home&id=2
So it would pick 2 from a $_REQUEST.
But I don't need another inc file, I need it to work like this:

Code: Select all

index.php&id=2
Is there a way to use the $_REQUEST without an include file - ie. directly from the PHP source??

Simon

Re: Can you query the URL without an INC file?

Posted: Thu Jul 23, 2009 6:52 am
by jackpf
I don't understand...why can't you use the code you posted first?

Re: Can you query the URL without an INC file?

Posted: Thu Jul 23, 2009 7:14 am
by simonmlewis
It's because the script that checks their status is called loginstatus.php, and I want the page where they have to subcribe, to be subscribe.php.

One has to be passed to the other.

Re: Can you query the URL without an INC file?

Posted: Thu Jul 23, 2009 8:17 am
by jackpf
So...you're including two files? And you want them both to be able to access the same ID?

When you include a file, it's given the variable/function scope of the parent file, so it will have access to $_GET['id'].

Is this what you mean?

[RESOLVED] Re: Can you query the URL without an INC file?

Posted: Thu Jul 23, 2009 9:56 am
by simonmlewis
Hi, I have actually worked it out myself now.

If you have $id = $_REQUEST['id']; at the start of the posted to page, and the redirect says subscribe.php?id=2, then it works a treat.

Simon