Results 1 to 13 of 13
  1. #1
    Join Date
    Jul 2003
    Posts
    5

    Unanswered: <form method="post" action=""> Why Blank?

    I'm trying to make this as short as possible:

    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 ?>" ?
    [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 ---------------*/

    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <form method="post" action="<?php echo $PHP_SELF ?>">
    <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>

    EXTREMELY IMPORTANT TO NOTICE:::::::

    WHEN PRESSING SUBMIT I CAN'T LOGIN


    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="" ------------*/ #################


    <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">
    <form method="post" action=""> //;#########look at action="" nothing here-WTF?
    <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>
    Last edited by rhs98; 03-29-04 at 04:33.

  2. #2
    Join Date
    Feb 2003
    Location
    Germany
    Posts
    20
    You get these notices (not errors) beacuse the variables are not declared before. Either init those variables with
    $var = '';
    set the error-reporting level lower or turn of error-logging.

  3. #3
    Join Date
    Sep 2003
    Posts
    2
    You don't have oh the password of phpmanager.zip to send me!
    Send for my e-mail, I am needing urgently!

    Thank you very much!

    Respectfully,
    Joćo Paulo.

  4. #4
    Join Date
    Sep 2003
    Posts
    2
    You don't have oh the password of phpmanager.zip to send me!
    Send for my e-mail, I am needing urgently!

    e-mail: joaopaulo.web@globo.com


    Thank you very much!

    Respectfully,
    Joćo Paulo.

  5. #5
    Join Date
    Sep 2003
    Location
    Wisconsin, USA
    Posts
    34

    php4.1

    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']; ?>">

  6. #6
    Join Date
    Oct 2003
    Posts
    16

    Re: php4.1

    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
    [PHP]
    <?php
    if (isset($HTTP_POST_VARS['submit']))
    {
    $username=$HTTP_POST_VARS['username'];
    $password=$HTTP_POST_VARS['password'];
    $submit=$HTTP_POST_VARS['submit'];
    } else
    {
    $username="";
    $password="";
    $submit="";
    }

    Hope that helps.

    -Chris
    Bite Size Inc, Telework Consultants
    http://www.bitesizeinc.net/

    Check out the SQL tutorial at
    http://www.bitesizeinc.net/index.php/sql.html

  7. #7
    Join Date
    Jul 2003
    Posts
    5
    Hey thanks, I'll will try that. Sorry it took me so long to reply. I will let you know if it works or not.
    blood

  8. #8
    Join Date
    Jul 2003
    Posts
    5
    Originally posted by Poison_BR
    You don't have oh the password of phpmanager.zip to send me!
    Send for my e-mail, I am needing urgently!

    Thank you very much!

    Respectfully,
    Joćo Paulo.
    There is no password to the zip file.

  9. #9
    Join Date
    Mar 2004
    Posts
    3

    PIRACY!

    Please note, those of you who are downloading the above phpmanager.zip file are in breach of international copyright law.

    You can purchase licenses at: http://www.neomanager.com for $40.

    MODS - PLEASE REMOVE THE ATTACHMENT IMMEDIATELY!

  10. #10
    Join Date
    Jan 2004
    Posts
    12
    Also, you shouldn't use $HTTP_POST_VARS anymore, use $_POST

  11. #11
    Join Date
    Mar 2004
    Posts
    3
    Please do not assist this person further!

    They have broken copyright law.

    MODS PLEASE REMOVE THE ATTACHMENT!

  12. #12
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    I have removed the attachment re:the above claim. Please contact me blood and explain your self.

  13. #13
    Join Date
    Mar 2004
    Posts
    3
    Thanks for removing the attachment.

    Blood please contact us immediately: abuse@neomanager.com and explain your actions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •