<select> php generator class

Download combo.zip (875 bytes)

This free php script generates the html code that displays a select menu like the one shown below. It saves you the time and effort of creating the code manually and allows you to easily modify the contents of the menu whenever you want easily.

Here is the generated <select> menu:

You may view the HTML source of this page to
see the code that displays the above menu.

And here is the PHP code that generated it:


	$myselect = new Select;
	$myselect->ListItem = array("First Item", "Second Item", "Third Item", "Fourth Item", "Fifth Item");
	$myselect->ListData = array("1", "2", "3", "4", "5");
	$myselect->SelectName = "item";
	$myselect->SelectedData = 3;
	echo $myselect->HTML;


Comments on the above code

You can paste the above code into any PHP script on your server to generate the <select> menu. You must put the file 'combo.php' in the same folder as that of your script.

Notice the $myselect->SelectedData line. You can choose the initial preselected item in the menu by providing its value in this line. That's why in the above menu 'Third Item' is selected by default.

Values assigned to ListData and ListItem can be gathered from a database or a file or any other dynamic input. Thus you can dynamically change the data in the menu.

About Bigprof.com:
Bigprof.com is a website devoted to the open source community. We provide many solutions for PHP developers. One of our most outstanding programs is AppGini, the automatic PHP generator for producing powerful and customizable front-ends for MySQL databases. Download your free copy now!