Multiple submits broken in PHP5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sheldonlg@asap-consult.com

    #1

    Multiple submits broken in PHP5

    I have a page with multiple submit buttons. Call them "ok" and
    "cancel". I have the coding in PHP as:

    if (isset($ok)) { something } and if (isset($cancel) ) { something
    else }

    This works fine in PHP 4.X. In PHP5 it doesn't work at all (no action
    at all). What is the replacement coding and how can I code so that it
    works in all versions of PHP?

    Shelly

  • Ewoud Dronkert

    #2
    Re: Multiple submits broken in PHP5

    On 26 May 2005 04:51:49 -0700, sheldonlg@asap-consult.com wrote:[color=blue]
    > I have a page with multiple submit buttons. Call them "ok" and
    > "cancel". I have the coding in PHP as:
    > if (isset($ok)) { something } and if (isset($cancel) ) { something
    > else }[/color]

    Oh man. http://php.net/manual/en/security.globals.php


    --
    Firefox Web Browser - Rediscover the web - http://getffox.com/
    Thunderbird E-mail and Newsgroups - http://gettbird.com/

    Comment

    • ECRIA Public Mail Buffer

      #3
      Re: Multiple submits broken in PHP5

      It should be noted that this is not an issue of PHP 4 versus 5, but rather
      of different configurations (php.ini files).

      You are able to access $ok and $cancel because they are automatically set as
      global variables in your PHP 4 config. You should disable this - only
      goodwill can stop me from submitting a form with a field called "query" set
      to drop all your databases...

      To do so, open your php.ini file (probably located in your PHP folder or
      your Windows folder - on Windows) and change the line that reads:

      register_global s = On

      to

      register_global s = Off

      Now, you not be able to access $ok or $cancel directly - instead, you can
      access them through the $_GET or $_POST arrays(dependin g on your form
      method). For example, if your form method is POST, then you can use this:

      if (isset($_POST["ok"])) { something } and if (isset($_POST["$cancel"]))
      { something else }

      ECRIA
      http://www.ecria.com


      Comment

      Working...