SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: variables

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    variables

    hello

    can someone tell me how i pass variables from one .php page to another, found documentation that mentions sessions and another that mentions $GLOBALS but nether are very clear and i'm a bit confused.

    thanks in advance
    a+
    Garrett

  2. #2
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well there are a couple answers to this. If you are using a form with an action of another PHP page they are passed automatically. If not, you could pass them in the URL, like mypage.php?var1=value1&var2=value2 etc.
    Kevin

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no no forms.
    is'nt there something like ...


    $b = 2;
    Function Sum () {
    $GLOBALS["b"];
    }
    Sum ();
    echo $b;

    that uses globals, trouble is cant call sum from the other page? if not this how do i pass the variable in the url (rather not do this as i have lots of variables to pass)

    a+
    garrett

  4. #4
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In that case I believe globals is just making $b available to the function which it isn't by default.

    Maybe you could describe more of what you are trying to accomplish. There are a number of ways you could do it - sessions and/or cookies, for starters.
    Kevin

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i am doing some experiments with imagegif(); where i am creating triangles from six variables which are set randomly, each variable corresponds to the x or y of a triangle point, then i am calculating the centre of the triangle to floodfill it.

    trouble is my floodfill messes up about once in every ten refreshes of the page so i am trying to debug the thing by echoing my variables to the page, cant do this because for some reason the echo does not work in the same page as the imagegif(); probably to do with the header! so... i am tring to echo my variables on another .php page which is displaying the image with <img src="image.php"> but i need to know how to pull them from the first.

    get me? its actually not as hard to do as my bad explanation is to understand.

    a+
    garrett


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •