this script I copied from webmonkey doesn't work 100%.

From what I can tell, the isset function is always evaluating to true.

It is only supposed to evaluate to true if the variable $begin is not included in the link URL.

As the link url seems to be generated properly later in the script , the isset(!$begin) should evaluate to true and the $begin variable should be available to the script to use. Right?

If someone can find any error, I would be very grateful.

Code file attached

    Sounds like you are using global variable. Always a "no, no"...

    Try:

    if(isset($_GET["begin"])) {
        #begin is set
    }
    else {
        #begin is not set
    }

      Why are you using isset(!$begin)?? just do something like pyro mentioned:

      $begin = $_GET['begin'];
      if(isset($begin))
      {
      //begin is set
      }
      else
      {
      //begin is not set
      }
      

        Pyro & Batman,

        You guys are legends! Worked perfectly.

        The original code I sent was from a webmonkey tutorial.

        Why would someone try to use isset($begin)?

        Does that even make sense?

        Cheers, Ian

          In older versions of PHP, global variables were set to be on as a default. Now, in newer versions, they are turned OFF, as a default. So, if the tutorial was written a while back, that would explain it. If not, there is no excuse... :p

            code written 7/1/2001

            that explains it.

            How do you turn global variables on?

            Ian

              You need to edit the php.ini file. It is about 1/4 or 1/3 of the way down:

              From php.ini
              ; Whether or not to register the EGPCS variables as global variables. You may
              ; want to turn this off if you don't want to clutter your scripts' global scope
              ; with user data. This makes most sense when coupled with track_vars - in which
              ; case you can access all of the GPC variables through the $HTTP*VARS[],
              ; variables.
              ;
              ; You should do your best to write your scripts so that they do not require
              ; register_globals to be on; Using form variables as globals can easily lead
              ; to possible security problems, if the code is not very well thought of.
              register_globals = Off

              But, as I said, it is far better not to use them...

                Write a Reply...