NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page A simple function to create numbered or alphabetical drop down menus in PHP

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-30-2003, 06:53 PM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Aug 2002
Posts: 1,255
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
 



A simple function to create numbered or alphabetical drop down menus in PHP


This is a simple and/or silly little function to create numbered or alphabetical dropdown menus. It could be useful if you needed to create alot of them on one page. I threw it together quickly so I'm sure it could be improved. It takes three arguments, name, startcount, and limit. name is the only required argument.
????: NamePros.com http://www.namepros.com/code/15483-simple-function-create-numbered-alphabetical-drop.html
PHP Code:
<?php
        
// 
       //
      //Code by deadserious - © 2003 http://www.webdesigntalk.net
     //THIS CODE IS FREEWARE AND CAN BE USED FOR BOTH 
    //COMMERCIAL AND NON-COMMERCIAL USE. REPUBLICATION
   //OF THE CODE REQUIRES OUR PERMISSION. 
  //webmaster@webdesigntalk.net


    
function dropdown $name$count 97$limit 122 ) {
     echo 
"t<select name="$name">n";
      for (
$i=$count$i<=$limit$i++) {
       if (
$count == 1) {
         echo 
"tt<option>$i</option>n";
       } else {
         echo 
"tt<option>" chr($i) . "n";
       }
      }
     echo 
"t</select>n";
    }

//useage for numbered dropdown counting from 1 to 50:


dropdown(rows,1,50);


//for numbered dropdown counting from 1 to 25:


dropdown(mydropdown,1,25);


//useage for alphabetical dropdown from a to z, just put in the name
//This drop down has the name of alphadrop, nothing else is necessary:


dropdown(alphadrop);


//for alphabetical dropdown listing from a to k
????: NamePros.com http://www.namepros.com/showthread.php?t=15483
//a starts at 97 and ends at 122 so you'll have to  do
//some thinking to determine which number to go to :-)


dropdown(newdrop,97,107);

?>
deadserious is offline  
Old 10-31-2003, 09:36 AM   #2 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
 


Breast Cancer
i needed this!


thanks
adam_uk is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 11:26 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger