Taking Control of basename($_SERVER['PHP_SELF']);

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
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Taking Control of basename($_SERVER['PHP_SELF']);

Post by NewfieBilko »

Is there anyway to take control of basename($_SERVER['PHP_SELF']);

?

What i mean is, to make it store into a variable for hmmm display, usage, whatever
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's just a normal variable, you can do almost anything you want with it as is.
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post by NewfieBilko »

how do you figure that basename($_SERVER['PHP_SELF']); is a usable variable

I mean if you wanted to pass the output of it to a database you can't just say INSERT "basename($_SERVER['PHP_SELF']);" lol

you know what i mean?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I mean if you wanted to pass the output of it to a database you can't just say INSERT "basename($_SERVER['PHP_SELF']);" lol
Sure you can.

Code: Select all

$sql = "INSERT INTO foo (filename) VALUES ('".basename($_SERVER['PHP_SELF'])."')";
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post by NewfieBilko »

right, ($_SERVER['PHP_SELF']) is an array variable

and i can just use it in all ways? weiurd, cause i was having some problems pulling the data from it into a template.
$mark= ($_SERVER['PHP_SELF'])

then template {echo $mark}
but i guess what your saying is that since its a global variable i should be able to use it in my template too ($_SERVER['PHP_SELF']) in the templating file ...
Post Reply