Need some minor PHP help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chodadog
    Confirmed User
    • Apr 2002
    • 9736

    #1

    Need some minor PHP help

    Okay, i'm going to be sending people to a webpage with an "s" variable.

    page.php?s=1

    Now, on that page, i need another linking code to do some kind of "if" thing depending on what the value of s is.

    So, if s=1 in the URL to the page they user is currently on, then s in the link i'm creating will be, say, 12. And if s=2, then s in the link on the page will be 14.

    Make sense? Probably not!
    26 + 6 = 1
  • AcidMax
    Confirmed User
    • May 2002
    • 1827

    #2
    You could do something like

    $s_values[1] = 12;
    $s_values[2] = 14;


    Then have something like

    $this_s_value = $s_values[$_GET["s"]];


    That would make $this_s_value = whatever you have setup above. For example:

    If s = 1;

    The code I just had would basically make it like this.

    $this_s_value = $s_values[1]; // which is 12

    Hope that makes sense and is what you want.

    Andy
    Latest MMA news. http://www.mmawrapup.com

    Comment

    • Volantt
      Confirmed User
      • Nov 2003
      • 745

      #3
      In PHP there is a SWITCH method... check it out


      http://www.php.net/manual/en/control...res.switch.php

      *EDIT* not what you were looking for? Good reading anyways.
      Last edited by Volantt; 07-23-2004, 07:51 AM.
      "Only the dead have seen the end of war." - Plato
      "In the abscence of orders, go find something and kill it." - Erwin Rommel
      "A man's worth is no greater then the worth of his ambitions." - Marcus Aurelius

      Comment

      • chodadog
        Confirmed User
        • Apr 2002
        • 9736

        #4
        Thanks guys. Just what i need. Cheers!
        26 + 6 = 1

        Comment

        • cfU
          Confirmed User
          • Jan 2003
          • 933

          #5
          " "if" thing " ...hee hee, that was funny

          Comment

          • Tom_PMs
            Confirmed User
            • Jun 2004
            • 2049

            #6
            Nice idea for filtering

            You've read it, you can't unread it.

            Comment

            • Volantt
              Confirmed User
              • Nov 2003
              • 745

              #7
              Glad we could help.
              "Only the dead have seen the end of war." - Plato
              "In the abscence of orders, go find something and kill it." - Erwin Rommel
              "A man's worth is no greater then the worth of his ambitions." - Marcus Aurelius

              Comment

              • chodadog
                Confirmed User
                • Apr 2002
                • 9736

                #8
                Originally posted by cfU
                " "if" thing " ...hee hee, that was funny
                Hey, gimme a break. I ain't down with all that technical jive! haha.
                26 + 6 = 1

                Comment

                • cfU
                  Confirmed User
                  • Jan 2003
                  • 933

                  #9
                  Originally posted by chodadog
                  Hey, gimme a break. I ain't down with all that technical jive! haha.
                  hahaha, jk bro - just made me chuckle

                  Comment

                  Working...