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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Notice: Undefined variable: PHP_SELF in C...

Status
Not open for further replies.

alfalf

Programmer
Mar 6, 2003
155
BA
Hello.

Why?
I use PHP4 (cgi binary) on Apache2 on W2K. Thx.
 
Yes, yes, no problem. This is the code wich causes this error:

<form action=&quot;<?php echo $PHP_SELF ?>&quot; method=&quot;post&quot;>
Enter <b>whois</b> query string: <input type=&quot;text&quot; name=&quot;WhoisQuery&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
</form>

Thx.
 
Try this:

<form action=&quot;<?php echo $HTTP_SERVER_VARS[&quot;PHP_SELF&quot;]; ?>&quot; method=&quot;post&quot;>


--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
PHP_SELF is only available when register_globals is set to ON. Otherwise you have to use the superglobal arrays.

The fact that register_globals is OFF makes me beleive that your PHP version is at least 4.2.0 since PHP's default setting is OFF since that version.

You should then refer to $_SERVER['PHP_SELF'] instead.

Versions before 4.1.0 used to name the superglobal arrays differently:
$HTTP_SERVER_VARS, $HHTP_POST_VARS etc.
ALthough these identifiers are still accessible they are deprecated and you should use $_SERVER, $_POST etc. if your version is 4.2.0 or later.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top