[SOLVED] URL Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

[SOLVED] URL Question

Post by Sphen001 »

Hi,

I have a question about URL's. Right now, I'm wondering if it's possible to add some stuff onto the end of a filename. An example:

I have this code, which includes a file.

Code: Select all

<?php
require ('./index.php');
?>
I was wondering if it's possible to add some data to the end of it, so that the URL that would appear would be:

Code: Select all

http://www.site.tld/index.php?blah=1
The blah=1 is what I want to add via the require function.

The goal for this is that I run a site which includes a specific page into the index. I have a blacklist approach, and I want it so that if someone goes to a URL that calls a page that doesn't exist, I want to load the main page, with the extra data on the end of the URL, so that I can run some error routines.

Thanks for any help :D

Sphen001
Last edited by Sphen001 on Tue Jul 12, 2005 9:20 pm, edited 1 time in total.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

with require or include you can not append a url var.

what you could do however is set your url vars on your "main" page like such:

Code: Select all

$_GET['var1'] = 1;
include('blah.php');
then on blah.php you can reference your url var that you set on the "main" page.
Post Reply