Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$PHP_SELF

Status
Not open for further replies.

rfrenke

Programmer
Joined
Jun 21, 2003
Messages
9
Location
US
I have a login page, and in the form tag I have the action set to:
Code:
action=&quot;<?php echo $PHP_SELF; ?>&quot;

Now I have tried both of these setups:
Code:
<form name=&quot;login&quot; method=&quot;post&quot; action=&quot;<?php echo $PHP_SELF; ?>&quot;>

<form name=&quot;login&quot; method=&quot;post&quot; action=&quot;<?php echo ($_SERVER[$PHP_SELF]); ?>&quot;>

And nothing happens. When I do a view source, this is what I see:
Code:
<form name=&quot;login&quot; method=&quot;post&quot; action=&quot;&quot;>

This page used to work until I upgraded to apache 1.3.26 & php 4.2.3 . Would the upgrade have anything to do with it?
 
To elaborate on sleipnir's post:

Code:
$_SERVER[$PHP_SELF]);

The array key you refer to is a variable, namely $PHP_SELF, which is as you know from your testing is uninitialized, i.e. empty.

As sleipnir recommeds, use the $_SERVER[] array and enclose the literals that refer to the array elements in quotes.

$PHP_SELF is not available after ig register_globals is off (after 4.2.0 default).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top