PHP Classes

File: class.ComboBox.php

Recommend this page to a friend!
  Classes of Jeff Hines   ComboBox   class.ComboBox.php   Download  
File: class.ComboBox.php
Role: ???
Content type: text/plain
Description: Class file
Class: ComboBox
Author: By
Last change:
Date: 23 years ago
Size: 1,356 bytes
 

Contents

Class file image Download
/* ** Author: Jeff Hines (hinesweb@bellsouth.net) ** Class ComboBox ** Creates a list box using two fields. ** Assuming that the first field is the field ID and the second field is the list data. */ <? require("uservariables.php3"); class ComboBox { var $tableName; var $databaseName; /* Begin Edit Constructor */ function ComboBox( $tblname, $dbname ){ $this->tableName = $tblname; $this->databaseName = $dbname; /* Connect to database */ if (!($link = mysql_pconnect ($hostName, $userName, $password))){ echo("Error connecting to $hostName<BR>"); exit(); } @mysql_select_db("$this->databaseName") or die("Unable to select database"); $para_query=mysql_query("select * from $this->tableName") or die(mysql_error()); /* Begin result table */ echo("<table width=100>"); echo("<select size=\"1\" name=\"id\">"); while ($row = mysql_fetch_array($para_query)) { /* Output combo box */ echo("<option value="); echo( $row[ 0 ] ); echo(">"); echo( $row[ 1 ] ); echo("</option>"); } echo("</select>"); echo("</table>"); /* End result table */ }// End Constructor }// End Edit ?>