Código PHP:
<?
class combobox
{
public $sql;
function __construct($table,$option,$value)
{
$this->table=$table;
$this->option=$option;
$this->value=$value;
$sql = "select * from ".$this->table;
$this->sql=$sql;
$result = mysql_query($this->sql) or die (mysql_error());
$this->result=$result;
echo "<select name='$this->table' class='botones'>";
while($fila = mysql_fetch_assoc($this->result))
{
echo "<option value='$fila[$value]'>$fila[$option]</option>";
}
echo "</select>";
mysql_close();
}
}
include("bd.php");
Conexion();
$test = new combobox("listas","producto","id_producto");
?>