Thursday, April 17, 2014 Login · Register
    Login
Username

Password


Remember Me

Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.

 

    Users Online
  • · Members on IRC: 53   
  • · Total Members: 14,484
  • · Newest Member: PySHD
  •  

     

        Related Ads
     

     

     

        Top 10 Forum Posters
    UserPosts
    bluechill1411   
    madf0x1277   
    cruizrisner1057   
    Qwexotic1034   
    Null Set869   
    auditorsec603   
    Override602   
    godofcereal599   
    TurboBorland585   
    Teddy469   
     

        Affiliates




  • iExploit


  • iExploit


  • WeChall





  • Thisislegal.com

  •  

        Related Ads
     

    View Thread
         
    Security Override Coding PHP Development
    php - Handy Drop down menu function
    Register FAQ Members List Today's Posts Search

    Print Thread
    01-18-2014 02:37 PM php - Handy Drop down menu function | Edited by Merlin21 01-18-2014 02:38 PM
    A handy php function to create drop down menus for large tables. The drop down menus are created from an array.
    Thought I would share. Happy coding.

    Download source  Code

    function dropdown( $name, array $options, $selected)
       {
        /*** begin the select ***/
        $dropdown = '<select name="'.$name.'" id="'.$name.'" style="width:150px;">'."\n";

        $selected = $selected;
        /*** loop over the options ***/
        foreach( $options as $key=>$option )
        {
            /*** assign a selected value ***/
            $select = $selected==$key ? ' selected' : null;

            /*** add each option to the dropdown ***/
            $dropdown .= '<option value="'.$key.'"'.$select.'>'.$option.'</option>'."\n";
        }

        /*** close the select ***/
        $dropdown .= '</select>'."\n";

        /*** and return the completed dropdown ***/
        return $dropdown;
       }


     
    Offline
    Jump to Forum:
    Forum powered by fusionBoard