Playing with PHP. Got a little hanger...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Validus
    Confirmed User
    • Jul 2001
    • 4012

    #1

    Playing with PHP. Got a little hanger...

    I was playing last night with some PHP and... I got stuck... what am I doing wrong?



    PHP Code:
    <?PHP
    $line = file('tpl/gen_text.tpl');
    
    if(!empty($_GET["scr"]))
     { switch($scr) {
        case "DE":
            print("$line[1]");
            break;
        case "EN": 
            print("$line[2]");
            break;
        default:
            print("$line[1]");
            } } 
    else { 
    print("$line[1]");
    }
    ?>
  • Bad B0y
    Confirmed User
    • Aug 2002
    • 160

    #2
    What error do you get?

    Comment

    • Validus
      Confirmed User
      • Jul 2001
      • 4012

      #3
      Well.. index?scr=DE works... but.. index?scr=EN doesn't show nothing!

      Comment

      • Bad B0y
        Confirmed User
        • Aug 2002
        • 160

        #4
        Make sure that there are at least 3 lines in the file ;-)

        Comment

        • Validus
          Confirmed User
          • Jul 2001
          • 4012

          #5
          So line 1 is acutally `0?

          Comment

          • Bad B0y
            Confirmed User
            • Aug 2002
            • 160

            #6
            Originally posted by Validus
            So line 1 is acutally `0?
            Yep.

            Comment

            • Validus
              Confirmed User
              • Jul 2001
              • 4012

              #7
              U didn't by any chance ban me from #php did you?

              Comment

              • Validus
                Confirmed User
                • Jul 2001
                • 4012

                #8
                I guess not :-)

                Comment

                • kevinale
                  Confirmed User
                  • Dec 2002
                  • 2115

                  #9
                  You don't have the variable $scr defined...

                  change this :

                  switch($scr)

                  to this

                  switch($_GET["scr"])
                  1monkey0cup.com

                  Comment

                  Working...