Below is a login form. The line that I want to focus on here is:
<form method="post" action="<?php echo $PHP_SELF ?>">
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 ?>
[LOGIN FORM]
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
../$templates
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 ?>" ?
Code: Select all
[client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: adminname in D:\usr\www\website\htdocs\phpmanager\admin\index.php on line 27 [client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: password in D:\usr\www\website\htdocs\phpmanager\admin\index.php on line 28 [client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: submit in D:\usr\www\website\htdocs\phpmanager\admin\index.php on line 45 [client XX.XXX.XXX.XXX] PHP Notice: Undefined variable: PHP_SELF in D:\usr\www\website\htdocs\phpmanager\templates\default\admin\stafflogin.inc on line 4[/quote] /* --------- HERE IS THE STAFFLOGIN.INC FORM ---------------*/ <table width="570" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="570" height="360" align="center" class="main"> [color=blue]<form method="post" action="<?php echo $PHP_SELF ?>">[/color] <table border="0" cellspacing="0" cellpadding="2"> <tr> <td align="right" class="main"> Username: <input type="text" class="formfield" name="adminname"> </td> </tr> <tr> <td align="right" class="main"> Password: <input type="password" class="formfield" name="password"> </td> </tr> <tr> <td align="center"> <input type="Submit" name="submit" value="Login" class="formfield"> </td> </tr> </table> </form> </td> </tr> </table> [color=red]EXTREMELY IMPORTANT TO NOTICE::::::: WHEN PRESSING SUBMIT I CAN'T LOGIN[/color] 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 [color=red](action="")[/color]. 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="" ------------*/ ################# <html> <head> <title>phpManager - Staff Login</title> <LINK rel="stylesheet" type="text/css" href="../templates/default/styles.css"> </head> <body> <table width="570" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="570" height="360" align="center" class="main"> [color=blue]<form method="post" [color=red]action=""[/color]>[/color] //;[color=red]#########look at action="" nothing here-WTF?[/color] <table border="0" cellspacing="0" cellpadding="2"> <tr> <td align="right" class="main"> Username: <input type="text" class="formfield" name="adminname"> </td> </tr> <tr> <td align="right" class="main"> Password: <input type="password" class="formfield" name="password"> </td> </tr> <tr> <td align="center"> <input type="Submit" name="submit" value="Login" class="formfield"> </td> </tr> </table> </form> </td> </tr> </table> </body> </html>