Array trouble ( 5 Views )

no kitty!
  1. Hey guys, I have this stuff I'm doing for a univ project for my class and I'm having trouble with an array. It seems very simple...but I cant figure it out.

    I have the following:

    PHP Code:

    $choice = array(
            
    "ACP"        => "admin/cp",
            
    "AWK"        => "admin/workers",
            
    "AWBRZ"        => "admin/workersbrowse",    
            
    "AWADD"    => "admin/workersadd",
            
    "AWEDIT"    => "admin/workersedit",    
            
    "AWDEL"   => "emp/rent",
                     
    "ERENT"    => "emp/rent",
                     
    "ESELL"    => "emp/sell",
                     
    "ERTN"     => "emp/return",
                     
    "EREF"     => "emp/refund",                
                    
    "DEX"      => "full/dexin",
    // FROM HERE--------------------------------------
                     
    "BRZ"      => "full/browse",
                     
    "SCH"      => "full/search",
            
    "TRMS"        => "full/terms",
            
    "LGN"        => "full/login",
            
    "ABT"        => "full/about"
             "HLP"        
    => "full/help",
            
    "OUT"        => "full/logout",
            
    "LGNERR"    => "full/loginerror"
                   
    );

    I choose from the array by the following:
    $choice[$mychoice];

    Where $mychoice = $_GET['act']

    Everything below from the "//FROM HERE----" line works, but anything from the above doesn work.

    e.g if i feed the url: http://localhost/index.php?act=ACP, it gets changed to http://localhost/index.php?act= .

    I wonder why this is happening, anyoine can help me out here.

    I need it bad!!!!
    cheers guys
    asT.

    (furkan, Namibia)

  2. Quote:

    Originally Posted by astericks

    PHP Code:

    $choice = array(
            
    "ACP"        => "admin/cp",
            
    "AWK"        => "admin/workers",
            
    "AWBRZ"        => "admin/workersbrowse",    
            
    "AWADD"    => "admin/workersadd",
            
    "AWEDIT"    => "admin/workersedit",    
            
    "AWDEL"   =>
                     
    "ERENT"    => "emp/rent",


    What's going on there after "AWDEL" ? Looks like you're missing a value?
    I would of thought you'd get a parse error from that.

    --ed

    (seren, Grenada)

  3. that was an error from copy/paste. The codes are good. I edited the post above.

    EDIT: N/M, I found the problem. It whad nothing to do with the arrray. Thanks for trying though, cheers

    (ceyhun, Portugal)



Related Topics ... (or search in 1.720.883 topics !)

array trouble (2)
using and array in a function trouble (6)
trouble with foreach and array (7)
trouble getting array to work (3)
array output trouble? (1)
multidimensional array trouble (3)
trouble sorting this array. (8)
adding an array to a session trouble (12)
trouble adding array components (3)




copyright © 2007-2031 Pfodere.COM ( 5 Pfoyihuee Online )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
1.4185