PHP config(?) problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris

    PHP config(?) problem

    I'm trying to learn PHP, and I'm having a strange problem with my local
    install on SuSE 9.0. I have a script here:



    Here, it works fine. When I try to run the same script on my local machine,
    however, I always get "0". I tried a little debug code, and none of the
    form values carry over into the variables. This happens with other scripts
    as well. Scripts with output only (no form variables) work fine. Why would
    this be happening?

    Chris

    chris casey at ev1 dot net
  • Chris Hope

    #2
    Re: PHP config(?) problem

    Chris wrote:
    [color=blue]
    > I'm trying to learn PHP, and I'm having a strange problem with my local
    > install on SuSE 9.0. I have a script here:
    >
    > http://www.little-people-austin.com/~chris/estpop.php
    >
    > Here, it works fine. When I try to run the same script on my local
    > machine, however, I always get "0". I tried a little debug code, and none
    > of the form values carry over into the variables. This happens with other
    > scripts as well. Scripts with output only (no form variables) work fine.
    > Why would this be happening?[/color]

    I'm guessing you're trying to access the variables using eg $foo when you
    should really be using $_POST['foo'] or $_REQUEST['foo'] (and there's also
    the $_GET and $_COOKIE arrays).

    Depending on the version of PHP these are not available as $_POST, $_GET etc
    but instead as $HTTP_POST_VARS , $HTTP_GET_VARS etc. They changed the
    behavior in 4.1.0 but are still available in current versions of PHP.

    Check out the manual at
    https://www.php.net/manual/en/langua...s.external.php for more info.

    Chris

    --
    Chris Hope
    The Electric Toolbox - http://www.electrictoolbox.com/

    Comment

    • StinkFinger

      #3
      Re: PHP config(?) problem

      worked fine here. nice script.

      "Chris" <chris@suse.loc al> wrote in message
      news:108p26j9g3 mif26@corp.supe rnews.com...[color=blue]
      > I'm trying to learn PHP, and I'm having a strange problem with my local
      > install on SuSE 9.0. I have a script here:
      >
      > http://www.little-people-austin.com/~chris/estpop.php
      >
      > Here, it works fine. When I try to run the same script on my local
      > machine,
      > however, I always get "0". I tried a little debug code, and none of the
      > form values carry over into the variables. This happens with other scripts
      > as well. Scripts with output only (no form variables) work fine. Why would
      > this be happening?
      >
      > Chris
      >
      > chris casey at ev1 dot net[/color]


      Comment

      • Chris

        #4
        Re: PHP config(?) problem

        Chris wrote:

        <snip>

        Well, a little digging through the php manual set me straight. I'm using php
        4.3.3, while my hosting service is using 4.0.6. The only way I can find to
        get my install to act like theirs is to set register_global s = On in the
        php.ini file. Either that or hope my hosting service upgrades (virtual
        host, not likely).

        If anyone has any other ideas, feel free to post.

        Thanks to all who replied (or were going to).

        Chris

        Comment

        • Chris Hope

          #5
          Re: PHP config(?) problem

          Chris wrote:
          [color=blue]
          > Chris wrote:
          >
          > <snip>
          >
          > Well, a little digging through the php manual set me straight. I'm using
          > php 4.3.3, while my hosting service is using 4.0.6. The only way I can
          > find to get my install to act like theirs is to set register_global s = On
          > in the php.ini file. Either that or hope my hosting service upgrades
          > (virtual host, not likely).
          >
          > If anyone has any other ideas, feel free to post.[/color]

          Use $HTTP_POST_VARS['foo'] instead of $foo or $_POST['foo'] and it should
          work nicely for both versions. Refer to my other post for more details.

          You can also change the value of register_global s in your Apache config file
          for a particular virtual host, if you're using Apache with the following
          directive in a <virtualhost> section:

          php_value register_global s 1

          Doing this means you can just change the value for this particular
          virtualhost if you are developing for more than one on your dev box.

          --
          Chris Hope
          The Electric Toolbox - http://www.electrictoolbox.com/

          Comment

          Working...