And in this line I want some one to explain to me in detail what this does insided this line?
Now I know I could do something like this, if I had a *.cgi to execute
<form method="post" action="process.cgi">
But this script is in PHP and there is no cgi or PHP that I know of that needs
to be called on?
<?php echo $PHP_SELF ?>
The reason I'm asking is every time I press the submit button the form goes no were
and I get these Apache error. Actually, I get these errors as soon as I load the
form in my browser, even before I press the submit button. This is exactly
when the errors occur. They occur as soon as I load the form. Now the form is an .inc
file called stafflogin.inc. it is shown below.
PATHS: I am using paths such as this
include "../variables.php"; and so on. I tried to change all my paths to Absolute paths
but this did not help.
So could some one help me understand why I am receiving these errors (Apache Error Log) and
what exactly is "<?php echo $PHP_SELF ?>" ?
[APACHE ERROR LOG]
[client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: adminname in D:\usr\www\website\htdocs\phpmanager\admin\index.p hp on line 27
[client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: password in D:\usr\www\website\htdocs\phpmanager\admin\index.p hp on line 28
[client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: submit in D:\usr\www\website\htdocs\phpmanager\admin\index.p hp on line 45
[client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: PHP_SELF in D:\usr\www\website\htdocs\phpmanager\templates\def ault\admin\stafflogin.inc on line 4
/* --------- HERE IS THE STAFFLOGIN.INC FROM ---------------*/
Here is a copy of the form's source code when I go to load it into my
browser. Remember that it is being called from the "staffloggin.inc"
and notice that (action=""). Nothing there for action? This is what and
were my script is locking up or failing. I dont know what "action" to give it.
If someone would be so kind to install the script and test it I will be
more than glad to email it to you.
/*-------------- FORM'S SOURCE CODE WHEN LOADED INTO BROWSER
NOTICE THERE IS NOTHING IN THE action="" ------------*/ #################
Originally posted by moku
If you're using php4.1.0 or higher, you need to use the new method of accessing pre-defined variables.
What you want is:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
This is the reason for the PHP_SELF warning....
In addition, your script has a line that reads something like if ($username!="") and one for the $password variable, and aparently one for $submit.
You can choose to ignore those errors, since they will not effect the operation, but you may also be having problems with them since the new version of php needs you to access them out of the $HTTP_POST_VARS['username'] variable.
I would stick the following code at the top of your script to clear up the other messages