<?php
//########################################################################################
//
// -------------- Author
// mumi - 2004
// hide@address.com
//
// Have fun !!!
//
//########################################################################################
require_once("./combo_box.conf.php");
class Combo_Box {
function Combo_Box($cb_name,$table_name,$order_by="",$asc="",$css_class="",$id="") {
if ($table_name) {
if($id) {
$disable = " disabled ";
}
if ($order_by) {
$order_by = " ORDER BY ".$order_by." ".$asc;
}
$sql = "SELECT * FROM ".$table_name.$order_by;
$result = mysql_query($sql);
$show_Combo_Box = ""
."<SELECT name=\"".$cb_name."\" class=\"".$css_class."\" ".$disable."> \n"
."<OPTION value=\"0\">Select</OPTION>\n";
WHILE ($row = mysql_fetch_array($result)) {
$selection = "";
if($id){
if($row[0] == $id){
$selection = " selected ";
}
}
$show_Combo_Box .= ""
."<OPTION value=\"".$row[0]."\" ".$selection.">"
.$row[1]
."</OPTION> \n";
} // End WHILE
$show_Combo_Box .= ""
."</SELECT>\n";
mysql_free_result($result);
echo $show_Combo_Box;
} // End if ($table_name)
} // End function Combo_Box
} // End class Combo_Box
?>