Problems after PHP update

Discussion in 'Programming/Scripts' started by uli, May 13, 2005.

  1. uli

    uli New Member

    I've updated my PHP installation on my server, but now most of my PHP scripts don't work anymore. For example, I have a login form like this:

    Code:
    <form action="login.php" method="post">
    Username: <input type="text" name="username" /><br />
    Password: <input type="password" name="password" /><br />
    <input type="submit" name="submit" value="Login" />
    </form>
    Now, if I do a
    PHP:
    echo $username;
    in login.php, it shows nothing... :confused:

    Uli
     
  2. joe

    joe HowtoForge Supporter

    It might have done something to your global variables. Try

    Code:
    echo $_POST[username]
    
    does that work?
     
  3. falko

    falko Super Moderator

    I think it's because register_globals went from on to off in your new PHP version. This is explained here: http://de3.php.net/manual/en/language.variables.predefined.php

    So you have to change your scripts (e.g. use $_POST['id'] instead of $id) or change register_globals to on in your php.ini (don't forget to restart Apache then).
     
  4. uli

    uli New Member

    Thanks Joe and Falko! That helped a lot! :) :)

    I set register_globals to on now in my php.ini, and my scripts are working again.

    Uli
     
  5. joe

    joe HowtoForge Supporter

    Glad it's working :)

    I would recommend using $_POST and $_GET rather than just plain $username. Keeps things more secure so an incident doesn't happen involving $password from GET instead of POST.
     
  6. uli

    uli New Member

    Right, but I'm rather lazy... :D

    Uli
     

Share This Page