What is $PHP_SELF and why it is not working in Localhost? I am using wampserver software.
Thank You
why $PHP_SELF is not working in localhost
Moderator: General Moderators
-
pankajdeoria
- Forum Newbie
- Posts: 15
- Joined: Thu Mar 12, 2009 10:58 am
- Location: Bangalore,India
Re: why $PHP_SELF is not working in localhost
$PHP_SELF is a preset constant in the PHP compiler that basically holds the value of the document that is calling the variable. So if you use $PHP_SELF in login.php assume the value is being replaced by the compiler with login.php. As to why it's not working, are you sure you're typing it properly. It's not a stand-alone variable, it's a value that is stored in an array of $_SERVER[] values. The proper usage is something like:
Code: Select all
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>" >
//...your form here
</form>
Re: why $PHP_SELF is not working in localhost
Code: Select all
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
//...your form here
</form>
This is not an "Advanced Discussion"