help passing php variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoyo2
    Registered User
    • Oct 2003
    • 9

    #1

    help passing php variables

    I need help in trying to pass php variables from page to page, so that I know how my different advertising campaigns are doing?? Im new to php and don't know how to do this...thanks
  • StuartD
    Sofa King Band
    • Jul 2002
    • 29903

    #2
    www.php.net
    This is me on facebook
    This is me on twitter

    Comment

    • BadBrad
      Confirmed User
      • Feb 2004
      • 618

      #3
      Do you mind passing these via the URL or is this something you don't want shown?
      Your sig chose me!

      Comment

      • JamesDotCom
        Registered User
        • Mar 2004
        • 35

        #4
        Not sure exactly what you are trying to achieve but it may be something like this. You have many different pages pointing one place and want to see where the hits are coming from? If so, this example might give you a rough idea.

        Many pages:

        <a href="http://this.is.my/single/page.php?referrer=here">Link 1</a>

        <a href="http://this.is.my/single/page.php?referrer=there">Link 1</a>


        The one page:

        <pre>
        &lt;?php
        if ($_GET["referrer"])
        {
        echo "Referrer: ".$_GET["referrer"];
        }
        else
        {
        echo "Came without a referral";
        }
        ?>
        </pre>
        Normally from within the if statement you would store the value in a database etc for future reference. Let me know if you need anymore help.

        Comment

        • yoyo2
          Registered User
          • Oct 2003
          • 9

          #5
          I actually want to pass them through the url...Here is what im trying to do: I have say 3 different advertisements pages (one.html?yahoo one.html?tgp one.html?linklist) and all of them will be advertising the same site..i just want to know how to pass on these variables through the sites tour until they hit the signup button? thanks guys

          Comment

          • AvanteGuard
            Confirmed User
            • Jan 2004
            • 451

            #6
            here's what i would do....

            To get this:

            tour1.php?from=yahoo
            tour2.php?from=yahoo
            tour3.php?from=yahoo

            on the forms do this:

            <a href='tour2.php?from=$from'>Next</a>
            <a href='tour3.php?from=$from'>Next</a>
            <a href='signup.php?from=$from'>Signup</a>

            **EDIT**
            PHP Code:
            <a href='tour2.php?from=$from'>Next</a>
            <a href='tour3.php?from=$from'>Next</a>
            <a href='signup.php?from=$from'>Signup</a> 
            
            **/EDIT**

            Or at least that's what I would do...you could try playing with cookies, but I wouldn't recommend it (but you could do it if you were trying to hide the "from=yahoo" part.

            Let me know if that works for you!
            Last edited by AvanteGuard; 03-22-2004, 07:07 PM.
            Looking for Fast Professional Programming? http://www.imadigan.com
            ICQ: 314-942-262 | MSN/Email: [email protected]

            Comment

            • slackologist
              Confirmed User
              • Jul 2002
              • 2379

              #7
              What JamesDotCom said. There are other ways but that is nice and easy.

              Comment

              • rickholio
                Confirmed User
                • Jan 2004
                • 1914

                #8
                Another option is to make use of sessions, which is specifically designed to track persistant data across requests to the same site (you didn't specify if the data had to be passed across multiple domains, or just different pages on the same domain)

                http://www.php.net/manual/en/ref.session.php

                should get you pointed in the right direction.
                ~

                Comment

                • yoyo2
                  Registered User
                  • Oct 2003
                  • 9

                  #9
                  I will need it for both...alot of my tgp galls will be on a different server than my paysite. So I will need to track this variable from my tgp.html?one over to my paysite and then through the tour pages to my signup page...just looking for something simple that works good. Do i need to change my php.ini? or do i just add this php code in my pages? thanks again

                  Comment

                  • Ash@phpFX
                    Confirmed User
                    • Nov 2003
                    • 4292

                    #10
                    can someone clue me in on how to do

                    xxx.html?something

                    rather than xxx.html?var=something


                    ive seen it used a lot but never used it myself.

                    thanks in advance

                    Comment

                    • yoyo2
                      Registered User
                      • Oct 2003
                      • 9

                      #11
                      bump......would also like to know how to do this: index.html?yahoo


                      thanks again

                      Comment

                      Working...