$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
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

$PHP_SELF

Post by thomasd1 »

why can't i do <?php echo $PHP_SELF ?> on my localhost?
it works on my lycos webspace ... :roll:
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

R u missing a ; ?
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

depending on your version and php settings, you might have to do $_SERVER['PHP_SELF'].
Look into register globals at php.net
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

good point. Either try <?=$PHP_SELF;?> or <?=$_SERVER['PHP_SELF'];?>
User avatar
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

Post by thomasd1 »

ok that worked

now i got URLs like:
http://localhost/test/string3.php?strin ... mit=Submit
this also doesn't work on mylocalhost... :roll:
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

To get those variables you need to use $_GET:

Code: Select all

echo $_GET['stringy'];       // thomas
echo $_GET['Submit'];       // Submit
User avatar
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

Post by thomasd1 »

damn, i knew that :D
Post Reply