Here is a very simplified version of the code
Works fine in php3 (for years). But now in php5 it simply repeatedly displays the button

Does anyone have any idea what I need to do to make it work in php5?

<?php
if ($Sendemail)
{ echo "display appropriate info for customer";
}

else
{
// display a form that allows customer to fill in info, and click the email button that is called Sendemail
?>

<form name="form1" method="post" action="">
<input type="submit" name="Sendemail" value="Send Email">
</form>
<?php
}
?>

    Since PHP 4.1, data from POSTed forms has been available through the $POST array (see [man]variables.external[/man]). So, for example $POST['Sendemail']; or, rather isset($_POST['Sendemail']) because you're wanting to see if it's present or not. See also this thread concerning the same issue.

    There are, however, likely to be a lot of other changes. The manual provides guides for upgrading from PHP 4 to the current version in the [man]Appendices[/man].

      M thanks, a combination of

      // Emulate register_globals on
      if (!ini_get('register_globals')) {
      $superglobals = array($SERVER, $ENV,
      $FILES, $COOKIE, $POST, $GET);
      if (isset($SESSION)) {
      array_unshift($superglobals, $
      SESSION);
      }
      foreach ($superglobals as $superglobal) {
      extract($superglobal, EXTR_SKIP);
      }
      }

      Put in at the very beginning of any php

      and

      isset($_POST['Sendemail'])

      Has done the trick and the php files are now working fine. Phew. I know the above is a bit of a fudge, but I don't want to do loads of coding on it

        The above is much more than just a "fudge" - it's reintroducing the possible security exploits and all of the bad behaviors that shoved register globals out the door in the first place. See [man]security.globals[/man] for more info on that.

          Yeah I know its sloppy, but so long as the thing works will do for me just now. I'm running the whole business by myself - making, selling, shipping, programming, and well, time just doesn't permit to go through all the variables!
          Thanks for all the help everyone

            Write a Reply...